Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // ConsoleApplication 4.2.cpp: определяет точку входа для консольного приложения.
  2. //
  3. #define _CRT_SECURE_NO_WARNINGS
  4.  
  5. #include "stdafx.h"
  6. #include <iostream>
  7. #define MAX 100
  8.  
  9. using namespace std;
  10.  
  11. bool Letters(char*);
  12.  
  13. int main()
  14. {
  15. char str1[MAX], str2[MAX];
  16. char razd[MAX] = { ' ', '.', ',', ':', ';', '!', '?', ' - ', '(', ')', '\0' };
  17.  
  18. cout << "enter ur string:\n";
  19. cin.getline(str1, MAX);
  20.  
  21. char *word = strtok(str1, razd);
  22.  
  23. while (word != NULL)
  24. {
  25. if (Letters(word))
  26. cout << word << endl;
  27.  
  28. word = strtok(NULL,razd);
  29. }
  30.  
  31.  
  32. system("pause");
  33. return 0;
  34. }
  35.  
  36. bool Letters(char* word)
  37. {
  38. int size = strlen(word);
  39.  
  40. for (int i = 0; i < size; i++)
  41. {
  42. if ((int)word[i] < 65 || (int)word[i] > 122) // латинские буквы с 65 по 122
  43. {
  44. return false;
  45.  
  46. }
  47. }
  48. return true;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement