help

This is a discussion on help within the C++ Programming forums, part of the General Programming Boards category; hi guys I started c++ programming the other day (had 2 calsses) and my teacher gave us a task to ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    help

    hi guys I started c++ programming the other day (had 2 calsses) and my teacher gave us a task to do and i have no idea how to to it along with 99% of the rest of my class. teh teacher refuses to help in any way so im buggered. this task will probably seem pretty easy to all you guys but for a newbie at C++ like me its rather difficult.


    i attatched the file so i hope it works

    cheers
    Attached Images Attached Images  

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    heres what i did for an ipo drawing but its not complete

    and most likely wrong
    Attached Images Attached Images  

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    come on someone help the poor guy out (me)


  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    nothing hard there. At least show some pseudocode at the very least if you want help with such a simple problem. Diagrams are all well and good but I find code easier to read. What particular bit are you struggling with. checking the input values? finding the trip value? whats the problem?

    PS... We dont allow thread bumping here. Read the forum rules.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    Here's a way to start:

    determine variables needed, eg:
    age
    gender

    determine tasks needed to do:
    ask for age input
    verify age input
    cycle until age in appropriate range

    ask for gender
    verify gender
    cycle until gender appropriate

    store input data somewhere until calculations done or collect data regarding various ages and genders on the fly

    put all the above in a loop to allow all task to repeat as long a user wants to.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    ok well hers the code i worked out can anyone see anything wrong with this
    Code:
    KEY
    id, 
    age, 
    gen(gender), 
    scount(total students above 21)
    mcount(male counter)
    fcount(female counter)
    tcount(total students)
    
    START
    Int id, age, gen, scount=0, mcount=0, fcount=0, tcount=0
    Int m, M f, F
    DOWHILE tcount ˇÜ 9999
    	DISPLAY ˇ°Enter idˇ±
    	READ id
    	IF id=1 to 9999
    	DISPLAY ˇ°Enter ageˇ±
    		IF age=16 to 25
    		IF age = >21
    			DISPLAY ˇ°Enter genˇ±
    			READ gen
    				IF gen = m, M
    				ADD 1 to mcount
    				IF else gen = f, F
    				ADD 1 to fcount
    			ELSE
    				DISPLAY ˇ°error messageˇ±
    			ENDIF
    		ELSE
    			ADD 1 to scount
    		ENDIF
    		ELSE
    			DISPLAY ˇ°error messageˇ±
                                    ENDIF
    	ELSE
    		DISPLAY ˇ°error messageˇ±
    	ENDIF
    ENDDO
    COMPUTE tcount = mcount + fcount
    DISPLAY scount, mcount, fcount, tcount
    END
    code tags

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    ummm not sure what happened in that post ti was all set out neatly with tab setup and so on but didint work and also some of my symbols like > and " " turned into wierd symbols so yeah i dunno wahts goin on there

  8. #8
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    LOL, this is the kind of post that I never bother to look at. The topic says "Help" and there is a little gem to the left.

    Oh wait, I just did
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

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