-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.cpp
More file actions
58 lines (57 loc) · 1.49 KB
/
5.cpp
File metadata and controls
58 lines (57 loc) · 1.49 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
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <fstream>
using namespace std;
string name[10];
int orders[10];
int prices1[10];
int main()
{
int option;
cout << "Press 1 To Enter Data & 2 To Check Result:......";
cin>>option;
if (option == 1)
{
for (int i = 0; i < 10; i++)
{
int option;
cout << "Enter The Customer: ";
cin >> name[i];
cout << "Enter Total Orders: ";
cin >> orders[i];
for (int j = 0; j < orders[i]; j++)
{
cout << "Enter The " << j + 1 << " Order Price: ";
cin >> prices1[j];
}
fstream file;
file.open("customer.txt", ios::app);
file << name[i] << " " << orders[i] << " [";
for (int k = 0; k < orders[i]; k++)
{
if (k < orders[i] - 1)
{
file << prices1[k] << ",";
}
else if (k == orders[i] - 1)
{
file << prices1[k] << "]" << endl;
break;
}
}
cout << "Press 1 To Enter More Data & 2 To Check Result:......";
cin >> option;
if (option == 1)
{
continue;
}
if (option == 2)
{
break;
}
}
}
if (option == 2)
{
}
return 0;
}