-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.cpp
46 lines (41 loc) · 844 Bytes
/
read.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
#include"stdafx.h"
#include"Header.h"
#include"global_variables.h"
#include"function_define.h"
#include"structs.h"
extern struct bill b[100];
void read()
{
std::ifstream ifs("store.xls");
if (ifs.is_open())
{
int rid, rquantity, rsprice, rbprice, rsaled, rprofit;
string rname;
while (!ifs.eof())
{
ifs >> rid;
ifs >> rname;
ifs >> rquantity;
ifs >> rbprice;
ifs >> rsprice;
ifs >> rsaled;
ifs >> rprofit;
// cout<<roll<<"\t"<<sfnam<<"\t"<<ssnam<<"\t"<<ffnam<<"\t"<<fsnam<<"\t"<<rclass<<"\t"<<num<<endl;
if (rid>0)
{
pid[rid] = rid;
pname[rid] = rname;
pquantity[rid] = rquantity;
pbprice[rid] = rbprice;
psprice[rid] = rsprice;
psaled[rid] = rsaled;
pprofit[rid] = rprofit;
}
}
ifs.close();
}
else {
// show message:
std::cout << "Error opening file";
}
}