@Sylar9
134 / 55 / 2
Регистрация: 04.09.2011
Сообщений: 1,952
|
|
|
06.12.2013, 20:27. Просмотров 2497. Ответов 5
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
48
49
50
51
52
53
54
| #include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef vector<string> Text;
bool can_be_grouped(const string&, const string&);
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
Text my_text;
string cur_word;
while(cin >> cur_word)
my_text.push_back(cur_word);
sort(my_text.begin(), my_text.end());
int group_index = 1;
string prev_word;
prev_word = my_text[0];
cout << "Group #" << group_index << endl
<< prev_word << endl;
for(size_t i = 1; i < my_text.size(); ++i)
{
if(can_be_grouped(prev_word, my_text[i]))
cout << my_text[i] << endl;
else
cout << "Group #" << ++group_index << endl
<< my_text[i] << endl;
prev_word = my_text[i];
}
return 0;
}
bool can_be_grouped(const string& str1, const string& str2)
{
return ((str1[0] == str2[0]) && (str1[1] == str2[1]) && (str1[2] == str2[2]));
} |
|
Вот ощибка
Ошибка 1 error C4996: 'freopen': This function or variable may be unsafe. Consider using freopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\users\lg\desktop\код.cpp 16 1 1
что не правельно
0
|