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 06-Mar-2004, 17:35
Skampy Skampy is offline
New Member
 
Join Date: Mar 2004
Posts: 4
Skampy is on a distinguished road
Unhappy

newbie using Sam's series


CPP / C++ / C Code:
//i'm a total newbie doing sam's teach yourself series and begging for any help
//this is typed exactly as in compiler for trying to set condition using
//else statement
#include <iostream>
int main()
}
int firstNumber, secondNumber;
    std::cout<<"Enter a number\n";
    std::cin>>firstNumber;
    std::cout<<"Enter a larger number\n";
    std::cin>>secondNumber;
if (firstNumber>secondNumber);
    std::cout<<"Good Job\n";
else // :cry: getting "parse error before else" message on compile
    std::cout<<"Wrong Answer\n";
return 0;
}
Last edited by dsmith : 06-Mar-2004 at 17:47. Reason: Please use the [c] & [/c] codes to display C highlighting
  #2  
Old 06-Mar-2004, 17:49
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi Skampy. There is several things wrong with your code
I have modified your code showing these things
CPP / C++ / C Code:

#include <iostream>
int main()
{    //As opposed to }, 
int firstNumber, secondNumber;
    std::cout<<"Enter a number\n";
    std::cin>>firstNumber;
    std::cout<<"Enter a larger number\n";
    std::cin>>secondNumber;
if (firstNumber>secondNumber)   //there is no semicolon after the if statement.
    std::cout<<"Good Job\n";
else // :cry: getting "parse error before else" message on compile
    std::cout<<"Wrong Answer\n";
return 0;
}

Try changing those 2 things and see if it works.
  #3  
Old 06-Mar-2004, 18:37
Skampy Skampy is offline
New Member
 
Join Date: Mar 2004
Posts: 4
Skampy is on a distinguished road

many thanks for the help


i replied via email to say thanks for the help but, i think i'm supposed to say it here-first time i've ever interacted in a forum before.
  #4  
Old 06-Mar-2004, 18:51
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Yep. You will get notified by email of a response, but you will need to come back to the forum to reply.

We hope to see you back around here.

Good luck with your learning!
 
 

Recent GIDBlogObservations of Iraq 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
Grouping data from MySQL with PHP - Newbie question. giobbi MySQL / PHP Forum 12 27-Feb-2004 00:34
C++ books for newbie mak90thug C++ Forum 4 04-Feb-2004 14:58
Problem with my Geforce video card Shivs Computer Hardware Forum 2 30-Jan-2004 20:54
Newbie Question about Borland andrewcarraway C++ Forum 4 24-Jan-2004 11:17
Newbie help, please Random C++ Forum 2 02-Dec-2003 12:05

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

All times are GMT -6. The time now is 05:43.


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