26.09.2016, 17:40. Просмотров 102. Ответов 0
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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
int choise, colvo, temp;
cout << "Enter the number of cars from 1 to 20:" << endl;
cin >> colvo;
string speed[30], brand[30], color[30];
for(int i = 0; i < colvo; i++)
{
cout << "Brand car: ";
cin >> brand[i];
cout << "Speed car: ";
cin >> speed[i];
cout << "Color car: ";
cin >> color[i];
}
do
{
system("cls");
cout << "Recording the first in the list - 1" << endl;
cout << "Remove the first item in the list - 2" << endl;
cout << "View the entire list - 3" << endl;
cout << "Remove items following the specified - 4" << endl;
cout << "Exit - 5" << endl;
cin >> choise;
system("cls");
switch(choise)
{
default:
cout << "Error" << endl;
system("pause");
break;
case 1:
colvo=colvo+1;
for(int i = 0; i < colvo; i++)
{
brand[colvo-i] = brand[colvo-i-1];
}
for(int i = 0; i < colvo; i++)
{
speed[colvo-i] = speed[colvo-i-1];
}
for(int i = 0; i < colvo; i++)
{
color[colvo-i] = color[colvo-i-1];
}
cin >> brand[0];
cin >> speed[0];
cin >> color[0];
system("cls");
for(int i = 0; i < colvo; i++)
{
cout << brand[i] << " " << speed[i] << " " << color[i] <<endl;
}
system("pause");
break;
case 2:
colvo=colvo-1;
for(int i = 0; i < colvo; i++)
{
brand[i] = brand[i+1];
}
for(int i = 0; i < colvo; i++)
{
speed[i] = speed[i+1];
}
for(int i = 0; i < colvo; i++)
{
color[i] = color[i+1];
}
for(int i = 0; i < colvo; i++)
{
cout << brand[i] << " " << speed[i] << " " << color[i] <<endl;
}
system("pause");
break;
case 3:
for(int i = 0; i < colvo; i++)
{
cout << brand[i] << " " << speed[i] << " " << color[i] <<endl;
}
system("pause");
break;
case 4:
cin >> temp;
colvo=temp-1;
for(int i = 0; i < colvo; i++)
{
cout << brand[i] << " " << speed[i] << " " << color[i] <<endl;
}
system("pause");
break;
case 5:
cout << "Goodbye" << endl;
system("pause");
break;
}
}while(choise != 5);
return 0;
} |
|
0
|