Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- char* InputSent(char* input, const int n)
- {
- cin.getline(input, n);
- char *ptr = input;
- return ptr;
- }
- void Output(int rez){
- cout << "Result: " << rez << endl;
- }
- int myFunc(char* text) {
- 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;
- return result;
- }
- void main()
- {
- const int n = 100;
- char input[n];
- char *p1 = input;
- Output(myFunc(InputSent(p1, n)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement