Gasoline Station Output

HELLO FRIENDS ?
can u help me to my project ?

i need to run this and to get the output of this, using a class ...
do you have any idea ? coz i dont know how ,SO SAD :(

how could i run this one ??? i need codes :( i hope u can help me thank you so much..

my instructor give me this one :

LITER=5;
PRICE:50;
AMOUNT=PRICE*LITER
FOR(A=0;A<AMOUNT;A++)}
FOR(B=0;B<1000;B++){

cout<<a;
}
}
Last edited on
What have you done so far?
IT MUST BE RUNNING LIKE A GASOLINE MACHINE FROM 0.0 TO THE SPECIFIC LITER NEEDED, AND ALSO THE PRICE MUST BE STARTING TO 0 TO THE SPECIFIC PRICE NEEDED.


#include <iostream>
#include <string>
using namespace std;

void main()
{

double ltr,price,liter;
char choice;

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"What type of Gasoline Fuel would you like to select?\n";
cout<<"[1] - Unleaded Fuel\n";
cout<<"[2] - Premium Fuel\n";
cout<<"[3] - Diesel Fuel\n";
cout<<"choice: ";
cin>>choice;

system("CLS");


if (choice=='1')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/40)*1;
cout<<"Unleaded purchased in litres: "<<ltr<<endl<<endl;
}

else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*40);
cout<<"The price for the Unleaded will be: "<<ltr<<endl;
}
else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}


}


if (choice=='2')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/35)*1;
cout<<"Premium purchased in litres: \n"<<ltr<<endl;
}


else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*35);
cout<<"The price for the Premium will be: \n"<<ltr<<endl;
}

else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}


}


if (choice=='3')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/30)*1;
cout<<"Diesel purchased in litres: "<<ltr<<endl;
}

else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*30);
cout<<"The price for the Diesel will be: \n"<<ltr<<endl;
}
else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}
}



}
I tagged the code so it looks better.

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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <iostream>
#include <string>
using namespace std;

void main()
{

double ltr,price,liter;
char choice;

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"What type of Gasoline Fuel would you like to select?\n";
cout<<"[1] - Unleaded Fuel\n";
cout<<"[2] - Premium Fuel\n";
cout<<"[3] - Diesel Fuel\n";
cout<<"choice: ";
cin>>choice;

system("CLS");


if (choice=='1')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/40)*1;
cout<<"Unleaded purchased in litres: "<<ltr<<endl<<endl;
}

else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*40);
cout<<"The price for the Unleaded will be: "<<ltr<<endl;
}
else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}


}


if (choice=='2')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/35)*1;
cout<<"Premium purchased in litres: \n"<<ltr<<endl;
}


else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*35);
cout<<"The price for the Premium will be: \n"<<ltr<<endl;
}

else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}


}


if (choice=='3')
{

cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Which of the following do you want to input?\n";
cout<<"[a] - PRICE\n";
cout<<"[b] - LITER\n";
cout<<"Choice: " ;
cin>>choice;

system("CLS");

if (choice=='a')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter the price: ";
cin>>price;
ltr=(price/30)*1;
cout<<"Diesel purchased in litres: "<<ltr<<endl;
}

else if(choice=='b')
{
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Enter your liter: ";
cin>>liter;
ltr=(liter*30);
cout<<"The price for the Diesel will be: \n"<<ltr<<endl;
}
else
{
system("CLS");
cout<<"\t\t\t\tMY GAS\n\n"<<endl;
cout<<"Invalid Input!"<<endl<<endl<<endl;
}
}



} 
main must return int - anything else is illegal C++.
Topic archived. No new replies allowed.