Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL,"");
- char str[256];
- cout << "Введите строку : ";
- cin.getline(str,256);
- double average, summa = 0 , count = 0;
- char* ptr=strtok(str," .,!?");
- do {
- summa = summa + strlen(ptr);
- count += 1;
- }
- while(ptr=strtok(NULL," .,!?"));
- average = summa / count ;
- cout << "Средняя длинна слов равна : " << average << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement