Need help debugging...

This is a discussion on Need help debugging... within the C++ Programming forums, part of the General Programming Boards category; Hey all, I am trying to write a simple program for doing basic inventory and sales for fruit....but when i ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    2

    Question Need help debugging...

    Hey all, I am trying to write a simple program for doing basic inventory and sales for fruit....but when i try to debug or compile it, i get a long string of errors that i cant get rid of...here is my source code...

    I believe i have posted the .cpp file..

    Thanks in advance

    insert
    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    int pears = 200;
    int apples = 150;
    int peaches = 300;
    int tomatoes = 250;
    int corn = 400;
    int userChoice;
    int sellChoice;
    int purchaseChoice;
    int menu(void);
    int main()
    {
    		cout << "Would you like to do purchase or sell fruit?" <<endl
    		<< "[1] Purchase Fruit" <<endl
    		<< "[2] Sell Fruit" <<endl;
    		cin >> userChoice;
    
    
    
    	(userChoice == 1)
    	;{
    
    		cout; << "What type of fruit do you want to purchase?" endl;
    	<< "[1] pears" endl;
    	<< "[2] apples" endl;
    	<< "[3] peaches" endl;
    	<< "[4] tomatoes" endl;
    	<< "[5] corn" endl;
    	cin; >>  purchaseChoice;
    	}
    	if(purchaseChoice == 1)
    	{
    		cout << "How many would you like to purchase?" endl;
    		cin >> bought;
    			if(bought < 5)
    			{
    				sells = .50 * bought;
    				cout << "You bought" <<bought<< "pears for $" <<sells;
    				pears=pears - bought;
    				cout << "You now have" <<pears<<"pears" endl
    			}
    			else
    			{
    				sells = .40 * bought;
    				cout << "You bought" <<bought<< "pears for $" <<sells;
    				pears=pears - bought;
    				cout << "You now have" <<pears<<"pears" endl
    			}
    	}
    
    if(purchaseChoice == 2)
    	{
    		cout << "How many would you like to purchase?" endl
    		cin >> bought;
    			if(bought)
    			{
    				sells = .25 * bought;
    				cout << "You bought" <<bought<< "apples for $" <<sells;
    				apples=apples - bought;
    				cout << "You now have" <<apples<<"apples" endl
    			}
    	}
    
    if(purchaseChoice == 3)
    	{
    		cout << "How many would you like to purchase?" endl;
    		cin >> bought;
    			if(bought < 5)
    			{
    				sells = .50 * bought;
    				cout << "You bought" <<bought<< "peaches for $" <<sells;
    				peaches=peaches - bought;
    				cout << "You now have" <<peaches<<"peaches" endl;
    			}
    			else
    			{
    				sells = .30 * bought;
    				cout << "You bought" <<bought<< "peaches for $" <<sells;
    				peaches=peaches - bought;
    				cout << "You now have" <<peaches<<"peaches" endl
    			}
    	}
    
    if(purchaseChoice == 4)
    	{
    		cout << "How many would you like to purchase?" endl
    		cin >> bought;
    			if(bought)
    			{
    				sells = .40 * bought;
    				cout << "You bought" <<bought<< "tomatoes for $" <<sells;
    				tomatoes=tomatoes - bought;
    				cout << "You now have" <<tomatoes<<"tomatoes" endl
    			}
    	}
    
    if(purchaseChoice == 5)
    	{
    		cout << "How many would you like to purchase?" endl
    		cin >> bought;
    			if(bought)
    			{
    				sells = .20 * bought;
    				cout << "You bought" <<bought<< "corn for $" <<sells;
    				corn=corn - bought;
    				cout << "You now have" <<corn<<"corn" endl
    			}
    		
    
    
    {
    	(userChoice == 2)
    	{
    
    		cout << "What type of fruit do you want to sell?" endl
    	<< "[1] pears" endl
    	<< "[2] apples" endl
    	<< "[3] peaches" endl
    	<< "[4] tomatoes" endl
    	<< "[5] corn" endl
    	cin >>  sellChoice;
    	}
    if(sellChoice == 1)
    	{
    		cout << "How many would you like to sell?" endl
    		cin >> sold;
    			if(sold < 5)
    			{
    				sells = .50 * sold;
    				cout << "You sold" <<sold<< "pears for $" <<sells;
    				pears=pears - sold;
    				cout << "You have" <<pears<<"pears left" endl
    			}
    			else
    			{
    				sells = .40 * sold;
    				cout << "You sold" <<sold<< "pears for $" <<sells;
    				pears=pears - sold;
    				cout << "You have" <<pears<<"pears left" endl
    			}
    	}
    
    if(sellChoice == 2)
    	{
    		cout << "How many would you like to sell?" endl
    		cin >> sold;
    			if(sold)
    			{
    				sells = .25 * sold;
    				cout << "You sold" <<sold<< "apples for $" <<sells;
    				apples=apples - sold;
    				cout << "You have" <<apples<<"apples left" endl
    			}
    	}
    if(sellChoice == 3)
    	{
    		cout << "How many would you like to sell?" endl
    		cin >> sold;
    			if(sold < 5)
    			{
    				sells = .50 * sold;
    				cout << "You sold" <<sold<< "peaches for $" <<sells;
    				peaches=peaches - sold;
    				cout << "You have" <<peaches<<"peaches left" endl
    			}
    			else
    			{
    				sells = .30 * sold;
    				cout << "You sold" <<sold<< "peaches for $" <<sells;
    				peaches=peaches - sold;
    				cout << "You now have" <<peaches<<"peaches left" endl
    			}
    	}
    if(sellChoice == 4)
    	{
    		cout << "How many would you like to sell?" endl
    		cin >> sold;
    			if(sold)
    			{
    				sells = .40 * sold;
    				cout << "You sold" <<sold<< "tomatoes for $" <<sells;
    				tomatoes=tomatoes - sold;
    				cout << "You have" <<tomatoes<<"tomatoes left" endl
    			}
    	}
    if(sellChoice == 5)
    	{
    		cout << "How many would you like to sell?" endl
    		cin >> sold;
    			if(sold)
    			{
    				sells = .20 * sold;
    				cout << "You sold" <<sold<< "corn for $" <<sells;
    				corn=corn - sold;
    				cout << "You now have" <<corn<<"corn left" endl
    			}
    	}
    
    
    cout << "You now have" endl
    <<pears<<"Pears" endl
    <<apples<<"Apples" endl
    <<peaches<<"Peaches" endl
    <<tomatoes<<"Tomatoes" endl
    <<corn<<"Corn" endl
    
    return 0;
    }
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    What are the error messages you are getting?

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2
    Here is the log i recieve when compling....

    insert
    Code:
    ------ Build started: Project: Fruit2, Configuration: Debug Win32 ------
    Compiling...
    Fruit.cpp
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(32) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(33) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(34) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(35) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(36) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(37) : error C2143: syntax error : missing ';' before '<<'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(38) : error C2143: syntax error : missing ';' before '>>'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(42) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(42) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(43) : error C2065: 'bought' : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(46) : error C2065: 'sells' : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(50) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(50) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(50) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(57) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(57) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(57) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(63) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(63) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(63) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(70) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(70) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(70) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(75) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(75) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(82) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(82) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(90) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(90) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(90) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(96) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(96) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(96) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(103) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(103) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(103) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(109) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(109) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(109) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(116) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(116) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(116) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(122) : error C2143: syntax error : missing ';' before '{'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(125) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(126) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(126) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(127) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(127) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(128) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(128) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(129) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(129) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(130) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(130) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(130) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(130) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(135) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(135) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(135) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(135) : error C2065: 'sold' : undeclared identifier
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(142) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(142) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(142) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(149) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(149) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(149) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(155) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(155) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(155) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(162) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(162) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(162) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(167) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(167) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(167) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(174) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(174) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(174) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(181) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(181) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(181) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(186) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(186) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(186) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(193) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(193) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(193) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(198) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(198) : error C2146: syntax error : missing ';' before identifier 'cin'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(198) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(205) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(205) : error C2143: syntax error : missing ';' before '}'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(205) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(210) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(210) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(211) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(211) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(212) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(212) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(213) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(213) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(214) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(214) : error C2563: mismatch in formal parameter list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(216) : error C2146: syntax error : missing ';' before identifier 'endl'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(216) : error C2143: syntax error : missing ';' before 'return'
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(216) : warning C4551: function call missing argument list
    c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(218) : fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\owner\my documents\visual studio 2005\projects\fruit\fruit\fruit.cpp(107)' was matched
    Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\Fruit2\Fruit2\Debug\BuildLog.htm"
    Fruit2 - 81 error(s), 26 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That's not "debugging", but rather fixing compiler errors. You should be able to do that by just fixing the errors mentioned. What do you think this means:
    syntax error : missing ';' before '<<'
    Ok, perhaps the error message isn't saying EXACTLY what is wrong, because it probably won't work to put a ; right before teh <<. But there is a semicolon missing just around there.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Yeah, just a bunch of missing semicolons and a few other typos and oddities.

    In addition, if you get a massive amount of compiler errors, fix the first few and recompile. It is possible that the compiler generates error messages about anything if it doesn't understand a single faulty line before.

    For that reason, if posting error messages, just post a few ones from the beginning.

    Also, don't let so many syntax errors accumulate. Compile the code more often, even if you don't have anything particularly runnable, and fix the errors before continuing.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  6. #6
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Code:
    int pears = 200;
    int apples = 150;
    int peaches = 300;
    int tomatoes = 250;
    int corn = 400;
    int userChoice;
    int sellChoice;
    int purchaseChoice;
    Do not use global variables unless you really have no choice. Declare them inside the main() function and make them local. If you need them in other functions then pass them by reference rather than by value if you know how to.
    I'm just trying to be a better person - My Name Is Earl

  7. #7
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,230
    Quote Originally Posted by anon View Post
    Yeah, just a bunch of missing semicolons and a few other typos and oddities.
    Actually, it looks like it's a bunch of EXTRA semicolons that shouldn't be there.

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,411
    Actually, the entire code looks like a mess.
    ; where they shouldn't be, missing <<, missing if, etc.
    I suggest the OP go back to syntax learning instead of dumping the errors on us.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Can I also recommend the approach of "develop a little bit of code, compile it, test it, add some more code, compile it, test it, and so on". This means that when you compile the code:
    1. You know what you did recently, which is PROBABLY where the problem is.
    2. You don't usually get TONS of errors for similar type problems, because you don't have so much unknown code.
    3. You know that the bit of code before this change was working.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dev-C++: Problems with Breakpoint Debugging
    By Thileepan_Bala in forum C Programming
    Replies: 1
    Last Post: 01-17-2008, 09:48 AM
  2. Problem in debugging in Eclipse
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 08-21-2007, 09:53 AM
  3. Debugging Dev C++
    By tuurb046 in forum Tech Board
    Replies: 10
    Last Post: 08-16-2007, 12:51 PM
  4. Debugging book recommendation
    By dagans in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 09-13-2005, 07:35 PM
  5. debugging directx apps
    By confuted in forum C++ Programming
    Replies: 1
    Last Post: 08-16-2003, 08:56 AM

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