Artcik

ank

Apr 10th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #define PROG(typ, typ2) \
  5. for(int i=ile-1;i>1;i--){ \
  6. typ pomoc; \
  7. sscanf(arg[i],"%"#typ2,&pomoc); \
  8. printf("%"#typ2,pomoc); \
  9. printf(" "); \
  10. }
  11.  
  12.  
  13.  
  14. int main(int ile, char* arg[]) {
  15. if (ile < 2) {
  16. printf("\n POPRAWNE WYWOLANIE:");
  17. printf("\n program typ ciag_danych\n\n");
  18. }
  19. else
  20. if (strcmp(arg[1], "int") == 0) PROG(int, i)
  21. else
  22. if (strcmp(arg[1], "double") == 0) PROG(double, lf)
  23. else
  24. if (strcmp(arg[1], "char") == 0) PROG(char, c)
  25. else printf("\n ZNANE TYPY: int, double, char\n\n");
  26.  
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment