Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication 4.2.cpp: определяет точку входа для консольного приложения.
- //
- #define _CRT_SECURE_NO_WARNINGS
- #include "stdafx.h"
- #include <iostream>
- #define MAX 100
- using namespace std;
- bool Letters(char*);
- int main()
- {
- char str1[MAX], str2[MAX];
- char razd[MAX] = { ' ', '.', ',', ':', ';', '!', '?', ' - ', '(', ')', '\0' };
- cout << "enter ur string:\n";
- cin.getline(str1, MAX);
- char *word = strtok(str1, razd);
- while (word != NULL)
- {
- if (Letters(word))
- cout << word << endl;
- word = strtok(NULL,razd);
- }
- system("pause");
- return 0;
- }
- bool Letters(char* word)
- {
- int size = strlen(word);
- for (int i = 0; i < size; i++)
- {
- if ((int)word[i] < 65 || (int)word[i] > 122) // латинские буквы с 65 по 122
- {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement