read in txt file into assigned constant

Hello guys

im working on my C++ assignment

i have trouble reading string in txt to an assigned constant

this is my file


6
Joe
P 10.02 Y
Mary
r 15.50 N
Dan
U 19.00 y
Victoria
R 6.50 y
Nick
n 0 Y
Vigo
p 18.27 N

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
 
const double R = 3.39 ; const double U = 3.55; const double P = 3.65; const double N = 0; // 
const double WWG = 4.25; const double WWOG = 10; //  WWG= wash with gas over 30, WWOG = wash without gas or less than 10





double total, amount;
string name,choice; // choice = waht kind of oil
ifstream inputFile;
char wash; // wash or not wash

inputFile.open("customers.txt");

inputFile.ignore();
for (int a =0; a<5; a++)

{







inputFile >>name >> choice >> amount >> wash ;





























cout<<"********************************************************\n";
cout<<"*               Best Gas and Wash Service              *\n";
cout<<"********************************************************\n";
cout<<"           Customer : "<<name<< endl;
cout<<"                                                        \n";
cout.fixed;
cout<<"  Gallons purchased : "<<amount<< endl;
cout<<"  Price per gallon  : "<<choice<<endl; //it will show letters instead of the numbers i assigned in the beginning 
cout<<"\n";
cout<<" Total gasoline cost :";.
Last edited on
Topic archived. No new replies allowed.