main.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <stdio.h>
  2. static int input_test(void);
  3. static int scanf_test(void);
  4. int main()
  5. {
  6. /*
  7. char c1 = 'A';
  8. char c2 = 'B';
  9. char c3 = 'C';
  10. //puts(&c1);
  11. //char s[] = {'A', 'B', 'C', 0};
  12. char *s = "hello world";
  13. printf("hello: %-20s asfqwef\n", s);
  14. printf("%#d = %#x = %#o\n", 100, 100, 100);
  15. long long val = 0x1234567890adcdef;
  16. printf("%#lx\n", val);
  17. */
  18. //input_test();
  19. scanf_test();
  20. return 0;
  21. }
  22. // ввод символов
  23. static int input_test(void)
  24. {
  25. char c1, c2;
  26. //c = getchar();
  27. //printf("code: %#X: ", c);
  28. scanf("%c%*c", &c1);
  29. printf("code1: %d\n", c1);
  30. scanf("%c", &c2);
  31. printf("code2: %d\n", c2);
  32. return 0;
  33. }
  34. static int scanf_test(void)
  35. {
  36. char s[100];
  37. //scanf("%[1234567890]", s);
  38. //puts(s);
  39. //scanf("%[^\n]", s);
  40. //puts(s);
  41. char login[20];
  42. char password[20];
  43. scanf("login: %s password: %s", login, password);
  44. printf("login: %s\n", login);
  45. printf("password: %s\n", password);
  46. return 0;
  47. }