Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "you can enter 20 symbols" << endl;
- char a[21];
- cin.getline(a,21);
- cout << "these symbols take part in the test" << endl;
- cout << a << endl;
- int b=0;
- int word=0;
- int letters=0;
- int gaps=0;
- while ( b < 21)
- {
- if ( a[b] != ' ')
- {
- while (a[b] != ' ')
- {
- letters++;
- b++;
- }
- word++;
- }
- else
- {
- while (a[b] = ' ' )
- {
- gaps++;
- }
- }
- }
- cout << "these symbols have " << word ;
- cout << " words";
- cout << endl << letters;
- cout << "letters" << endl;
- cout << gaps << " gaps";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement