3 Error messages?

This is a discussion on 3 Error messages? within the C++ Programming forums, part of the General Programming Boards category; Hey everyone. I have this program due for an assignment tomorrow and I have 3 error messages in it. I ...

  1. #1
    Registered User hottiefee's Avatar
    Join Date
    Oct 2010
    Location
    TN, USA
    Posts
    32

    3 Error messages?

    Hey everyone. I have this program due for an assignment tomorrow and I have 3 error messages in it. I have no clue where I went wrong. Can someone please help me? I know it can't be anything major, I just need some help please.

    Here are the errors:

    1>c:\users\user\documents\visual studio 2008\projects\emissions\emissions\emissions.cpp(36 ) : error C2144: syntax error : 'int' should be preceded by ')'
    1>c:\users\user\documents\visual studio 2008\projects\emissions\emissions\emissions.cpp(36 ) : error C2660: 'permittedEmissions' : function does not take 0 arguments
    1>c:\users\user\documents\visual studio 2008\projects\emissions\emissions\emissions.cpp(36 ) : error C2059: syntax error : ')'


    Here is my program:

    Code:
    #include<iostream>
    using namespace std;
    
    void displayMenu();
    double permittedEmissions(int, double);
    
    int main(){
    	int type;
    	double grams;
    	double odometer;
    	const double CUT_OFF = 50000;
    	const double CO_L = 3.4;
    	const double CO_G = 4.2;
    	const double HC_L = 0.31;
    	const double HC_G = 0.39;
    	const double NO_L = 0.4;
    	const double NO_G = 0.5;
    	const double NMHC_L = 0.25;
    	const double NMHC_G = 0.31;
    	double permitted;
    
    	displayMenu();
    
    	cout << "Enter pollutant number>> " << endl;
    	cin >> type;
    	cout << "Enter number of grams emitted per mile>> " << endl;
    	cin >> grams;
    	cout << "Enter odometer reading>> " << endl;
    	cin >> odometer;
    
    	permittedEmissions(int type, double odometer);
    
    	return 0;
    }
    
    void displayMenu(){
    	cout << "           Menu" << endl;
    	cout << "(1) Carbon monoxide" << endl;
    	cout << "(2) Hydrocarbons" << endl;
    	cout << "(3) Nitrogen oxides" << endl;
    	cout << "(4) Nonmethane hydrocarbons" << endl;
    }
    
    double permittedEmissions(int type, double odometer){
    	double permittedLevel;
    
    	switch (type){
    		case 1: if (odometer <= 50000){
    					permittedLevel = 3.4;
    				}
    				else{
    					permittedLevel = 4.2;
    				}
    				break;
    		case 2: if (odometer <= 50000){
    					permittedLevel = 0.31;
    				}
    				else{
    					permittedLevel = 0.39;
    				}
    				break;
    		case 3: if (odometer <= 50000){
    					permittedLevel = 0.4;
    				}
    				else{
    					permittedLevel = 0.5;
    				}
    				break;
    		case 4: if (odometer <= 50000){
    					permittedLevel = 0.25;
    				}
    				else{
    					permittedLevel = 0.31;
    				}
    				break;
    		default: cout << "Invalid Choice" << endl;
    	}
    
    	return permittedLevel;
    }
    Thank you in advance for any and all help! (:

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Code:
    main(){...  	
    permittedEmissions(int type, double odometer); 
    ...}
    that's not how you call a function
    Code:
    	permittedEmissions(type, odometer);
    is what you want to do
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    When you call a function, just use the names of the variables, without their types.
    Code:
    permittedEmissions(int type, double odometer);
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User hottiefee's Avatar
    Join Date
    Oct 2010
    Location
    TN, USA
    Posts
    32
    Thank yall so much. I knew my problem wasn't that big.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21