Skip to content

Instantly share code, notes, and snippets.

@Mitmischer
Last active December 11, 2015 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mitmischer/4574181 to your computer and use it in GitHub Desktop.
Save Mitmischer/4574181 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <locale>
using namespace std;
int main()
{
locale loc;
string t;
int anzahl =1;
cout << "Text = ?" << endl;
getline (cin, t);
for (int i=0; i<t.length(); i++)
{
cout << toupper (t[i], loc);
if (t[i]==32)
{
anzahl++;
cout << endl;
}
}
cout << endl;
cout << "Anzahl der Woerter = " << anzahl << endl;
getline(cin,t);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment