Where is the problem?? C++

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
#include<iostream>
using namespace std;
int nain(int,char**) {
do 
{
    int miles,daysweek,weakyear,milage,milesperyear,gallonsperyear,gasmoneyperyear;
    double calculation=0,commute=0,gasprice,gasexpense;
    
    cout<<"How many round-trip miles a day do you commute"<<endl;
    cin>>miles;
    
    cout<<"How many days a week do you commute?"<<endl;
    cin>>daysweek;
    
    cout<<"How many weeks a year do you commute?"<<endl;
    cin>>weakyear;
    
    cout<<"How many miles per gallon does your vehicle get? "<<endl;
    cin>>milage;
    
    cout<<" What is the current per gallon price of gas?"<<endl;
    cin>>gasprice;
    
    milesperyear=miles*daysweek*weakyear;
    gallonsperyear=milesperyear/milage;
    gasmoneyperyear=gallonsperyear*gasprice;
    gasexpense=gasmoneyperyear/12;
    
    cout<<miles<<" miles a day "<<endl;
    cout<<daysweek<<" days a week "<<endl;
    cout<<weakyear<<" week a year"<<endl;
    cout<<milage<<"miles per gallon"<<endl;
    cout<<gasprice<<" dollars per gallon"<<endl;
    cout<<"monthly gas expense: $ "<<gasexpense;
        char anws;
                cout<<"Would you like to another cost of commute calculation Press 'Y' or 'y' for another calculation"
                cin>>anws;   
    

calculation=calculation+1;
costtotal=costtotal+gasexpense;
}
while(anws=='Y || anws=='y');

cout<<"This program executed"<<calculation<<"cost of commute calculations."<<endl;
cout<<"Total commute miles"<< commute <<endl;
cout<<"Average commute cost: $"<< costtotal;

system("pause");
return 0 ;
} 
Right here int nain(int,char**)
There might be more but I stopped looking when I reached that line.
Edit: Heres another while(anws=='Y || anws=='y');
Last edited on
previous poster pretty much had it. just take a look at how the lower part of the code is differently colored.
which platform and which version r you using for this program?
ohhh!! Thank's naraku9333 ,, I will check and I am gonna try again.
int nain should be int main()
How do I inputs between <angle brackets>?

For example,How many miles round-trip a day do you commute? <22>

Topic archived. No new replies allowed.