include iostream include string include time using namespace std char

 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <string.h>
#include <time.h>
using namespace std;
char day_of_today[20];
char t()
{
time_t now_time;
struct tm *timeinfo;
time(&now_time);
timeinfo = localtime(&now_time);
strftime(day_of_today, 100, "%d-%m-%Y %X",timeinfo);
}
int main()
{
char question[5][50] = {"На улице солнечно?", "Ты живешь в Бресте?", "Ты учишься в Бресте?", "Ты учишься в университете?", "Ты сейчас на занятиях?"};
char answer[2][50] = {"Круто!", "Жаль..."};
char ans[3][5] = {"yes", "no"};
int i=0;
for(i=0; i<5; i++)
{
t();
cout << day_of_today <<" <comp>: " << question[i] << endl;
t();
cout << day_of_today << " <you>: ";
cin >> ans[2];
t();
if(!strcmp(ans[2], ans[0]))
{
switch(i)
{
case 0:
cout << day_of_today <<" <comp>: " << answer[0] << endl;
break;
case 1:
cout << day_of_today <<" <comp>: " << answer[0] << endl;
break;
case 2:
cout << day_of_today <<" <comp>: " << answer[0] << endl;
break;
default:
cout << day_of_today <<" <comp>: " << answer[1] << endl;
break;
}
}
else
{
if(!strcmp(ans[2], ans[1]))
{
switch(i)
{
case 3:
cout << day_of_today <<" <comp>: " << answer[0] << endl;
break;
case 4:
cout << day_of_today <<" <comp>: " << answer[0] << endl;
break;
default:
cout << day_of_today <<" <comp>: " << answer[1] << endl;
break;
}
}
else
{
i--;
}
}
}
t();
cout << day_of_today <<" <comp>: " << "Buy!" << endl;
return 0;
}