Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("capslock.in");
  6. ofstream fout("capslock.out");
  7.  
  8. int main()
  9. {
  10. char v[256];
  11. fin.get(v, 256);
  12. int cnt = 0;
  13.  
  14. for(int i=0; v[i]; i++)
  15. {
  16. if(isupper(v[i]))
  17. v[i] = (int) v[i] + 32;
  18. }
  19.  
  20. for(int i=0; v[i]; i++)
  21. {
  22. if((int) v[i] == 35)
  23. {
  24. strcpy(v + i, v + i + 1);
  25. cnt ++;
  26. }
  27.  
  28. if(cnt%2!=0 && islower(v[i]))
  29. v[i] = (int) v[i] - 32;
  30.  
  31. }
  32.  
  33. fout << v;
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement