Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#202432 - 03/02/2004 20:40 beginner c++ question
kswish0
enthusiast

Registered: 06/02/2002
Posts: 212
Loc: Virginia, USA
I am in an intro c++ class and am having some trouble with a program. I basically have to make a simple math tutor. I have a certain form I'm supposed to follow. I have attached the source file for what I have done on this program so far. It is not complete yet, I still have to add the grade calculations, etc., but I want to get the menus working first (one step at a time). When I run this, it displays the first menu like I want it to, but when I give my selection, nothing happens. I figured it should be pretty easy for someone on this thread to see what I'm missing. Im sure it's probably something simple. And remember, I'm a beginner so don't laugh at my code. I know there are simpler ways to do this but I had to follow a certain form. Thanks in advance for your time.


Attachments
200994-assignment 1.cpp (88 downloads)


Top
#202433 - 03/02/2004 21:08 Re: beginner c++ question [Re: kswish0]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Take off the ; from the while loops...

Top
#202434 - 03/02/2004 21:17 Re: beginner c++ question [Re: tman]
kswish0
enthusiast

Registered: 06/02/2002
Posts: 212
Loc: Virginia, USA
Thanks! I knew it would be something simple like that. I didn't have the semicolon after the main while loop, I dont know why I put it after the nested loops.

Top
#202435 - 03/02/2004 21:30 Re: beginner c++ question [Re: tman]
Phoenix42
veteran

Registered: 21/03/2002
Posts: 1424
Loc: MA but Irish born
Ah that brings back the memories.

While working on a program over the weekend while at home a friend of mine was having great difficulty getting it to compile and was just getting more and more frustrated with it. His father seeing this going on, and probably concerned that the monitor was about to get tossed out the window, suggested that my friend step him through the code explaining what each line was doing. About half was down they found the ;

Top
#202436 - 03/02/2004 21:37 Re: beginner c++ question [Re: Phoenix42]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
It is always like that though. Unless you're paying attention you'll miss that extra ; at the end because you're skimming through.

Top
#202437 - 03/02/2004 22:14 Re: beginner c++ question [Re: Phoenix42]
tanstaafl.
carpal tunnel

Registered: 08/07/1999
Posts: 5549
Loc: Ajijic, Mexico
Ah that brings back the memories.


I remember working with my friend and business partner Dann. Truly a genius when it came to coding.

I would write a program that wouldn't work, spend hours trying to find out why and finally take it to him. He would usually find the problem in a matter of minutes (or less). He had this way of looking at source code with absolutely no preconceived notions of what was right and what was wrong. He would just digest it a line at a time and the bad line would jump out at him.

I was never able to develop that knack.

I got pretty good at spec'ing out a program -- determining what variables would need to be defined, what the general structure of the program would be, what the interface would look like. But Dann was the one who could write the clean code to really make it work.

Memories...

tanstaafl.
_________________________
"There Ain't No Such Thing As A Free Lunch"

Top
#202438 - 04/02/2004 02:36 Re: beginner c++ question [Re: tman]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Take off the ; from the while loops...

And see if you can turn up the warning level on your compiler. Most modern compilers will say something to the effect of "empty controlled statement -- did you mean the extra semicolon?"
_________________________
-- roger

Top