Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n;
  10. cout << "enter n: " << endl;
  11. cin >> n;
  12.  
  13. char str1[100];
  14.  
  15. char a[100][100];
  16.  
  17. for (int i = 0; i <= n; i++)
  18. {
  19. cin.getline(str1, 100);
  20. for (int j = 0; j < strlen(str1); j++)
  21. {
  22. a[i][j] = str1[j];
  23. }
  24.  
  25. }
  26.  
  27. for (int i = n; i > 0; i--)
  28. {
  29. bool hasOnlySmallLetters = true;
  30. for (int j = 0; str1[j]; j++)
  31. {
  32. if (a[i][j] < 'a' || a[i][j] > 'z')
  33. {
  34. hasOnlySmallLetters = false;
  35. }
  36. }
  37.  
  38. if (hasOnlySmallLetters)
  39. {
  40. for (int j = 0; str1[j]; j++)
  41. {
  42. cout << a[i][j];
  43. }
  44. }
  45. }
  46.  
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement