-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio.cpp
More file actions
51 lines (43 loc) · 914 Bytes
/
io.cpp
File metadata and controls
51 lines (43 loc) · 914 Bytes
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
#include <string>
#include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
string give_meaning(string info)
{
string s;
cout << info << " > ";
cin >> s;
return s;
}
int read_int(string caption, int min, int max)
{
int chislo = min;
do
{
if (chislo>max || chislo <min) cout << "Number must be between " << min << " and " << max << endl;
string s;
cout << caption;
cin >> s;
chislo = atoi(s.c_str());
}
while(chislo>max || chislo <min);
return chislo;
}
int give_typebike()
{
return read_int("Enter type of bike (1 - MTP, 2 - Road, 3 - Hybrid, 4 - Electro) > ", 1, 4);
}
int give_ages()
{
return read_int("Enter experience > ", 1, 80);
}
int read_member_id()
{
int chislo = 0;
string s;
cout << "Enter id > ";
cin >> s;
chislo = atoi(s.c_str());
return chislo;
}