Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <string>
- #include <sstream>
- using namespace std;
- int main (){
- register unsigned int count_word (0); // Слова
- register unsigned int count_letter (0); // Буквы
- string strone = "Moscow is the capital of Great Britain"; // Строка один
- string strtwo; // Пустая строка.
- istringstream str (strone);
- while (str >> strtwo){ // Подчитываем количесво строк.
- count_word ++;
- }
- for (int i(0); strone[i]; i++){
- if(strone[i] != ' '){
- count_letter ++;
- }
- }
- cout << "Numbe of letters: " << count_word << endl << "Number of words: "
- << count_letter << endl << "Average number of words: " << count_letter/count_word << endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement