GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Jan-2009, 21:38
epicjank epicjank is offline
New Member
 
Join Date: Jan 2009
Posts: 3
epicjank is an unknown quantity at this point

Error when compiling program


I'm pretty new at programming and ran into an error when compiling my program.

The code is as follows:
CPP / C++ / C Code:
#include <iostream>
using namespace std;

int main() ;

        double odds, money, betamt;
        cout << "Enter the odds for the event " << endl;
        cin >> odds;
        cout << "Enter your bet amount " << endl;
        cin >> odds;
        if odds > 0;
                money = odds + betamt - 100;
                cout << "You would win $" << money << "/n";
        else if odds < 0;
                money = odds + betamt + 100;
                cout << "You would win $" << money << "/n";

        return 0;
}

I get this error:
Code:
bet.cpp:7: error: expected constructor, destructor, or type conversion before ‘<<’ token
for lines 7-16, 18, 19.

I read through the guidelines for posting and I think I've got just about everything. Any help would be appreciated.
  #2  
Old 17-Jan-2009, 21:52
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Error when compiling program


CPP / C++ / C Code:
#include <iostream>
using namespace std;

int main()
{

        double odds, money, betamt;
        cout << "Enter the odds for the event " << endl;
        cin >> odds;
        cout << "Enter your bet amount " << endl;
        cin >> betamt;
        if (odds > 0)
        {
                money = odds + betamt - 100;
                cout << "You would win $" << money << "\n";
        }
        else if (odds < 0)
        {
                money = odds + betamt + 100;
                cout << "You would win $" << money << "\n";
        }
        return 0;
}
__________________
www.blake-foster.com
  #3  
Old 18-Jan-2009, 15:02
epicjank epicjank is offline
New Member
 
Join Date: Jan 2009
Posts: 3
epicjank is an unknown quantity at this point

Re: Error when compiling program


Quote:
Originally Posted by Blake
CPP / C++ / C Code:
#include <iostream>
using namespace std;

int main()
{

        double odds, money, betamt;
        cout << "Enter the odds for the event " << endl;
        cin >> odds;
        cout << "Enter your bet amount " << endl;
        cin >> betamt;
        if (odds > 0)
        {
                money = odds + betamt - 100;
                cout << "You would win $" << money << "\n";
        }
        else if (odds < 0)
        {
                money = odds + betamt + 100;
                cout << "You would win $" << money << "\n";
        }
        return 0;
}
That didn't really help me. I even put that in Terminal and still got errors when compiling.

Can someone let me know what I did wrong?
  #4  
Old 18-Jan-2009, 15:12
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Error when compiling program


Quote:
Originally Posted by epicjank
That didn't really help me. I even put that in Terminal and still got errors when compiling.

Can someone let me know what I did wrong?

You're welcome.

What compiler are you using? I fixed a number of syntax errors in the code I posted, and it compiles fine on my end. You'll need to provide some more info.
__________________
www.blake-foster.com
  #5  
Old 18-Jan-2009, 15:20
epicjank epicjank is offline
New Member
 
Join Date: Jan 2009
Posts: 3
epicjank is an unknown quantity at this point

Re: Error when compiling program


Quote:
Originally Posted by Blake
You're welcome.

What compiler are you using? I fixed a number of syntax errors in the code I posted, and it compiles fine on my end. You'll need to provide some more info.
My bad, I just put it in again and it worked fine. I don't know what happened. Thanks for your help.
  #6  
Old 18-Jan-2009, 15:24
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Error when compiling program


You're welcome.
__________________
www.blake-foster.com
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Equation solver RazoR C Programming Language 3 18-May-2008 10:24
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 11:13
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 04:48
Help with a complex program lordfuoco C++ Forum 5 24-Jun-2006 07:03

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:16.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.