Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int getline(char s[], int n){
  6. int c, i;
  7. for (i = 0; i<n && (c = getchar()) != EOF&&c != '\n'; i++) s[i] = c;
  8. s[i] = '\0';
  9. while (c != EOF&&c != '\n') c = getchar();
  10. return i;
  11. }
  12.  
  13. #define MAX 100
  14. int main()
  15. {
  16. int i, hiba = 0, hossz,szamlalo=0;
  17. char tomb[MAX];
  18.  
  19.  
  20. printf("Kerem adjon meg egy szoveget:\n");
  21. hossz = getline(tomb, MAX - 1);
  22.  
  23. for (i = 0; i < hossz; i++)
  24. {
  25. if (tomb[i] != '"' && szamlalo==0)
  26. {
  27. tomb[i] = toupper(tomb[i]);
  28.  
  29. }
  30. else if (tomb[i] == '"' && tomb[i-1]!='\\')
  31. {
  32. szamlalo++;
  33.  
  34. }
  35.  
  36. if (szamlalo == 2)
  37. {
  38. szamlalo = 0;
  39. }
  40.  
  41. }
  42.  
  43. printf("\n%s",tomb);
  44.  
  45. getchar();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement