Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- char* InputSent();
- char* myFunc(char* text);
- //char* InputSent()
- //{
- // const int n = 100;
- // char input[n];
- // cin.getline(input, n);
- // return input;
- //}
- void myFunc(){
- const char n = 100;
- char text[n];
- cout << "Enter string: ";
- cin.getline(text, 100);
- int wordSum = 1;
- int a = 0;
- for (int i(0); text[i] != '\0'; i++)
- {
- if (isalpha(text[i])){
- a++;
- }
- if (text[i] == ' '){ wordSum++; };
- }
- int result = a / wordSum;
- cout << "Result: " << result << endl;
- }
- void main()
- {
- myFunc();
- }
Add Comment
Please, Sign In to add comment