| | |
grade prediction program
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 7
Reputation:
Solved Threads: 0
here is my code i get an error of call of non function in lines 29, 34, 39 and 44
apprecite help or an alternate code if possible
here is code
apprecite help or an alternate code if possible
here is code
C Syntax (Toggle Plain Text)
int main (void) { char desiredgrade; double min_average; double currentaverage; double weight; double score; printf("Please enter your desired grade: \n"); scanf("%c", &desiredgrade); printf("Please enter your minimum average required: \n"); scanf("%lf", &min_average); printf("Please enter your current average in course: \n"); scanf("%lf", ¤taverage); printf("Please enter how much the final counts as a percentage of the course grade: \n"); scanf("%lf", &weight); if ( 92<=desiredgrade && desiredgrade>=100) { score=(min_average-(100-weight)(currentaverage/100)+(100/weight)); printf("You need a score of %.2f on the final to get A\n",score); } else if (84<=desiredgrade && desiredgrade>=91) { score=(min_average-(100-weight)(currentaverage/100)+(100/weight)); printf("You need a score of %.2f on the final to get B\n",score); } else if (76<=desiredgrade && desiredgrade>=83) { score=(min_average-(100-weight)(currentaverage/100)+(100/weight)); printf("You need a score of %.2f on the final to get C\n",score); } else if (68<=desiredgrade && desiredgrade>=75) { score=(min_average-(100-weight)(currentaverage/100)+(100/weight)); printf("You need a score of %.2f on the final to get D\n",score); return 0 ; } return score ; }
Last edited by WolfPack; Sep 6th, 2006 at 1:09 pm. Reason: Code Tags
You need some kind of operator between these brackets. Probably the multiplication operator.
(a)(b) doesnt mean a * b like in algebra. score=(min_average-(100-weight)(currentaverage/100)+(100/weight)); バルサミコ酢やっぱいらへんで
•
•
Join Date: Sep 2006
Posts: 7
Reputation:
Solved Threads: 0
Purpose: To determine data requirements.
To read input.
To process and output data.
To document a program.
Program: Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user as follows:
Enter Desired grade: B
Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25
You need a score of 94.20 on the final to get a B.
[79.5 - 75(.746)] * 4
this is waht his example works out to i need the formula
To read input.
To process and output data.
To document a program.
Program: Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user as follows:
Enter Desired grade: B
Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25
You need a score of 94.20 on the final to get a B.
[79.5 - 75(.746)] * 4
this is waht his example works out to i need the formula
•
•
•
•
Enter Desired grade: B
Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25
You need a score of 94.20 on the final to get a B.
[79.5 - 75(.746)] * 4
C Syntax (Toggle Plain Text)
#include <stdio.h> int main (void) { char desiredgrade; double min_average; double currentaverage; double weight; double score; printf("Please enter your desired grade: \n"); scanf("%c", &desiredgrade); printf("Please enter your minimum average required: \n"); scanf("%lf", &min_average); printf("Please enter your current average in course: \n"); scanf("%lf", ¤taverage); printf("Please enter how much the final counts as a percentage of the course grade: \n"); scanf("%lf", &weight); score=(min_average-((100-weight)*(currentaverage/100)))*(100/weight); printf("You need a score of %.2f on the final to get %c\n",score, desiredgrade); return 0; }
C Syntax (Toggle Plain Text)
Please enter your desired grade: B Please enter your minimum average required: 79.5 Please enter your current average in course: 74.6 Please enter how much the final counts as a percentage of the course grade: 25 You need a score of 94.20 on the final to get B
Last edited by WolfPack; Sep 6th, 2006 at 2:39 pm. Reason: removed "return score;" score is of type double. main returns int.
バルサミコ酢やっぱいらへんで
Yes you better follow the guidelines laid down by Wolfpack to solve your problem but while finalizing your code just replace the [inlinecode] scanf[/code] with either
Hope it helped, bye.
getchar () for gettign a character or fgets ( ) while getting a string.scanf is a prettly complex function and leaves the input stream dirty with the junk.Hope it helped, bye.
Last edited by ~s.o.s~; Sep 7th, 2006 at 2:04 pm.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
![]() |
Similar Threads
Other Threads in the C Forum
- Previous Thread: C--Structures(inside structure declaration of variable of same type is not allowed)
- Next Thread: string to long and string to double in c
Views: 1838 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createprocess() database directory drawing dynamic execv feet fgets file floatingpointvalidation fork framework function functions getlogicaldrivestrin givemetehcodez global grade graphics gtkwinlinux histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list looping loopinsideloop. lowest matrix meter microsoft mqqueue oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power process program programming pyramidusingturboccodes radix read recursion recv recvblocked reversing segmentationfault single socket socketprogramming spoonfeeding standard strchr string student suggestions system test testing threads unix urboc user whythiscodecausesegmentationfault win32api windowsapi






