-
Notifications
You must be signed in to change notification settings - Fork 0
/
Catalog.cpp
86 lines (81 loc) · 1.19 KB
/
Catalog.cpp
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
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <conio.h>
#include <cstdlib>
using namespace std;
char Baza (char *txt)
{
string line;
ifstream file(txt);
cout<<file.rdbuf()<<endl;
}
int Case(int id)
{
string name;
char *txt;
int money,k;
k=0;
switch (id)
{
case 100:
txt="100.txt";
break;
case 150:
txt="150.txt";
break;
case 200:
txt="200.txt";
break;
case 250:
txt="250.txt";
break;
case 300:
txt="300.txt";
break;
case 350:
txt="350.txt";
break;
case 400:
txt="400.txt";
break;
case 450:
txt="450.txt";;
break;
case 500:
txt="500.txt";
break;
case 550:
txt="550.txt";
break;
default:
txt="baza.txt";
cout<<"\nÒîâàðà ñ óêàçàííûì Id íå íàéäåíî\nÏîïðîáóéòå íàéòè íóæíûé òîâàð â áàçå äàííûõ\n"<<endl;
k=1;
}
Baza(txt);
cout<<endl;
return k;
}
int Id(int id)
{
int k;
cout<<"Ââåäèòå id èíòåðåñóþùåãî òîâàðà: ";
cin>>id;
Case(id);
return k;
}
int main()
{
int id,k;
setlocale(0,"");
k=0;
Id(id);
while(k==0)
{
Id(id);
}
getch();
return 0;
}