-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile_P10.cpp
More file actions
49 lines (49 loc) · 1.47 KB
/
File_P10.cpp
File metadata and controls
49 lines (49 loc) · 1.47 KB
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
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
clrscr();
ofstream of("chem.txt");
int id,n,qty,price,p,total=0;
char name[10],pname[10];
cout<<"\n\t\tCHEMICAL SHOP";
cout<<"\n\t\t-------------";
cout<<"\nEnter Number of Customer:";
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"\nCUSTOMER NUMBER"<<i;
cout<<"\nEnter Customer Name:";
cin>>name;
cout<<"\nEnter Product ID:";
cin>>id;
cout<<"\nEnter Chemical Name:";
cin>>pname;
cout<<"\nEnter Unit Price:";
cin>>price;
cout<<"\nEnter Product Quantity:";
cin>>qty;
p=price*qty;
total=total+p;
of<<name<<"\t\t"<<id<<"\t"<<pname<<"\t\t"<<price<<"\t"<<qty<<"\t\t"<<p<<"\n";
}
cout<<"\n------ FILE UPDATED ------";
cout<<"\n";
of.close();
cout<<"\n\t\t\tFERTILIZER BILL";
cout<<"\n-------------------------------------------------------------------------------";
ifstream fi("chem.txt");
cout<<"\n\nName"<<"\t"<<"PID"<<"\t"<<"ProductName"<<"\t"<<"UnitPrice"<<"\t"<<"Quantity"<<"\t"<<"Amount"<<"\n";
cout<<"-------------------------------------------------------------------------------\n";
for(int j=1;j<=n;j++)
{
fi>>name>>id>>pname>>price>>qty>>p;
cout<<name<<"\t"<<id<<"\t"<<pname<<"\t\t"<<price<<"\t"<<qty<<"\t"<<p<<"\n";
}
cout<<"\n-------------------------------------------------------------------------------";
cout<<"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTotal:"<<total;
cout<<"\n-------------------------------------------------------------------------------";
fi.close();
getch();
}