Last active
May 24, 2018 21:39
-
-
Save jezek/e394471b3e67d0479e413bb136f57477 to your computer and use it in GitHub Desktop.
C++ program (with makefile) that writes to standart output product of 2 numbers from user input and then itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
g++ main.cpp -o productWithItself |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char *program = (char *)"#include <stdio.h>%cchar *program = (char *)%c%s%c;%cmain() {%c int a, b;%c printf(%cEnter number a: %c);%c scanf(%c%%d%c, &a);%c printf(%cEnter number b: %c);%c scanf(%c%%d%c, &b);%c printf(%cProduct of a & b = %%d%cn%c, a*b);%c printf(program, 10, 34, program, 34, 10, 10, 10, 34, 34, 10, 34, 34, 10, 34, 34, 10, 34, 34, 10, 34, 92, 34, 10, 10, 10);%c}%c"; | |
main() { | |
int a, b; | |
printf("Enter number a: "); | |
scanf("%d", &a); | |
printf("Enter number b: "); | |
scanf("%d", &b); | |
printf("Product of a & b = %d\n", a*b); | |
printf(program, 10, 34, program, 34, 10, 10, 10, 34, 34, 10, 34, 34, 10, 34, 34, 10, 34, 34, 10, 34, 92, 34, 10, 10, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment