помогите пожалуйста переписать код на чистый си
C |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int number, counter=0;
string word;
ifstream fin("text.txt");
if (!fin.is_open()) {
cout << "File isn't found." << endl;
system("pause");
return 0;
}
cout << "Enter number words: ";
cin >> number;
if (!number)
return 0;
string * sentence = new string[number];
while (!fin.eof())
{
fin>>word;
sentence[(counter++)%number]=word;
if(word.find_first_of(".!?") != string::npos)
{
if (counter == number) {
for (int i=0; i<number; i++)
cout << sentence[i] << " ";
cout << endl;
}
counter=0;
word = "";
}
}
system("pause");
return 0;
} |
|