@zss
Модератор
6818 / 6380 / 2131
Регистрация: 18.12.2011
Сообщений: 16,737
|
25.06.2014, 09:11
|
|
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
| void func()
{
ifstream data("file.dat");
if(!data)
{
cout<<"iput file file.dat open error"<<endl;
return;
}
char a[100];
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*";
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*";
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*-"<< endl;
//cout << "\t\t\tYou are in the big room.\n\t\tAt centre of the room is swimming pool.\n\t\ You are see in the swimming pool an angry crocodile."<<endl<<endl;
//cout << "\n You are: (Please select '1' or '2', and press \"Enter\")"<< endl << endl;
//cout << " (1) Go away from the room. (2) Approach to the swimming pool."<< endl << endl;
for(int i=1;i<=6;i++)// чтение и вывод заголовка из файла
{
data.getline(a,100);
cout<<data;
}
char b[4,100];
for(int i=0;i<4;i++)// чтение 1 ситуации из файла
{
data.getline(b[i],100);
}
char c[4,100];
for(int i=0;i<4;i++)// чтение 2 ситуации из файла
{
data.getline(c[i],100);
}
char a1[2];
cin.getline(a1, 2);
if(strcmp (a1, "1") == 0)
{
for(int i=0;i<4;i++)// вывод 1 ситуации
cout<<b[i];
//cout << "\n\n You are see the crocodile, and you realizen what that is the most bloodthirsty \t of all the crocodile.\n\n";
//cout << " Your actions: (Please select '1' or '2', and press \"Enter\") " << endl << endl;
//cout << " (1) You're cute, you're running out of room.\n";
//cout << " (2) You're crazy, you're poke him in the eye by thumb of your left leg.\n";
}else
{
for(int i=0;i<4;i++)// вывод 2 ситуации
cout<<с[i];
//cout << "\n\n Crocodile bitten your leg. You haven't could go, crocodile have eaten you all.\n"<< endl << endl;
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*";
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*";
//cout << "*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*-";
}
// и т.д.
} |
|
0
|