| | |
Loop Program Wont work right..Help me please!
![]() |
•
•
Join Date: Sep 2005
Posts: 6
Reputation:
Solved Threads: 0
For research, the admissions office wants to compare how well female and male students perform in certain courses. You are asked to write a program that prompts the user to enter a number of student records consisting of (a) student’s sex (‘f’ for female, ‘m’ for male) and (b) GPA (a number in the range of 0.0 – 4.0) for each student.
The program should prompt the user to enter a letter code for the student’s sex (f or m), followed by the GPA value. The program should continue processing student records until the user enters a letter code other than ‘f’ or ‘m’ (handle both upper and lower case input)—this will indicate that there are no more student records to process.
The program should tabulate the following information:
- total number of female students
- average female student’s GPA
- total number of male students
- average male student’s GPA
- total number of students
- overall student GPA (males and females combined)
Sample Input Data
f 3.40
f 2.83
m 3.21
f 4.00
m 3.12
m 2.10
m 3.42
f 3.80
f 3.25
q (A letter code other than m or f indicates to QUIT)
Sample Program Output
Female students....... 5
Female Avg GPA ....... 3.46
Male students ........ 4
Male Avg GPA ......... 2.96
Overall Avg GPA ...... 3.24
----------------------------------
For some reason my code doesnt give me the right results? i would post my code but i know alot of people from my class come on here for help, so if anyone would be willing to help me please reply and ill pm you my code
thanks
The program should prompt the user to enter a letter code for the student’s sex (f or m), followed by the GPA value. The program should continue processing student records until the user enters a letter code other than ‘f’ or ‘m’ (handle both upper and lower case input)—this will indicate that there are no more student records to process.
The program should tabulate the following information:
- total number of female students
- average female student’s GPA
- total number of male students
- average male student’s GPA
- total number of students
- overall student GPA (males and females combined)
Sample Input Data
f 3.40
f 2.83
m 3.21
f 4.00
m 3.12
m 2.10
m 3.42
f 3.80
f 3.25
q (A letter code other than m or f indicates to QUIT)
Sample Program Output
Female students....... 5
Female Avg GPA ....... 3.46
Male students ........ 4
Male Avg GPA ......... 2.96
Overall Avg GPA ...... 3.24
----------------------------------
For some reason my code doesnt give me the right results? i would post my code but i know alot of people from my class come on here for help, so if anyone would be willing to help me please reply and ill pm you my code
thanks
![]() |
Similar Threads
- Help! My mouse wont work! (USB Devices and other Peripherals)
- Why won´t it ever work!? (Troubleshooting Dead Machines)
- Restart/shutdown&ctrl+alt+del wont work (Windows NT / 2000 / XP)
- Loop program help (C++)
Other Threads in the C Forum
- Previous Thread: MFC Tab controls
- Next Thread: putting the address of a function pointer into a struct
| Thread Tools | Search this Thread |
* ansi api array arrays bash binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile createcopyoffile createprocess() directory dynamic execv fflush file floatingpointvalidation fork forloop frequency function getlasterror getlogicaldrivestrin givemetehcodez grade graphics gtkgcurlcompiling gtkwinlinux hardware highest histogram homework i/o ide inches infiniteloop initialization input intmain() iso keyboard km license linked linkedlist linux list looping loopinsideloop. lowest matrix microsoft mysql oddnumber open opendocumentformat openwebfoundation pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string suggestions test testautomation threads unix urboc user variable whythiscodecausesegmentationfault win32api windows.h windowsapi






