Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- //Tu wpisać definicję makra PROG:
- #define PROG(typ, typ2) \
- for(int i=2;i<ile;i++){ \
- typ tab[ile]; \
- sscanf(arg[i],"%"#typ2,&tab[i]); \
- if(i%2 && tab[i]==0) printf("\nBLAD: dzielenie przez zero"); \
- else if(i>2 && i % 2) printf("%"#typ2,tab[i-1]/tab[i]); \
- printf(" "); \
- }
- int main(int ile, char* arg[]) {
- if (ile < 2) {
- printf("\n POPRAWNE WYWOLANIE:");
- printf("\n program typ ciag_danych\n\n");
- } else
- if (ile%2 == 1) {
- printf("\n POPRAWNE WYWOLANIE:");
- printf("\n ciag danych musi miec parzysta dlugosc\n\n");
- }
- else
- if (strcmp(arg[1], "int") == 0) PROG(int, i)
- else
- if (strcmp(arg[1], "double") == 0) PROG(double, lf)
- else printf("\n ZNANE TYPY: int, double\n\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment