Skip to content

Instantly share code, notes, and snippets.

@ernado
Created November 3, 2012 23:47
Show Gist options
  • Save ernado/4009358 to your computer and use it in GitHub Desktop.
Save ernado/4009358 to your computer and use it in GitHub Desktop.
#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