Created
November 3, 2012 23:47
-
-
Save ernado/4009358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int MAX_COUNT = 10; // максимальное количество слов | |
const int MAX_LENGTH = 80; // максимальная длинна слов | |
int main () | |
{ | |
char mass[MAX_COUNT][MAX_LENGTH]; | |
int words=0; // текущее слово | |
int chars=0; // текущий символ | |
char w; | |
while(1) | |
{ | |
cin.get(w); | |
if (w == ' ' || w == '.' || w == '/n') // конец слова | |
{ | |
mass[words][chars] = 0; // символ конца строки | |
words++; | |
chars=0; | |
if (w == '.') break; // ввод закончен | |
} | |
else | |
{ | |
mass[words][chars]=w; | |
chars++; | |
} | |
} | |
for(int n = 0; n < words; n++) | |
cout << mass[n] << endl; | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment