Click here to Skip to main content
15,890,407 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 1233569510-Nov-16 22:51
Member 1233569510-Nov-16 22:51 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Randor 11-Nov-16 4:06
professional Randor 11-Nov-16 4:06 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Albert Holguin10-Nov-16 7:36
professionalAlbert Holguin10-Nov-16 7:36 
QuestionHow to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear9-Nov-16 19:59
bestbear9-Nov-16 19:59 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
Richard MacCutchan9-Nov-16 22:52
mveRichard MacCutchan9-Nov-16 22:52 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
leon de boer10-Nov-16 9:06
leon de boer10-Nov-16 9:06 
GeneralRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear10-Nov-16 18:11
bestbear10-Nov-16 18:11 
QuestionC programming Determine Students grade Pin
Member 128422149-Nov-16 12:37
Member 128422149-Nov-16 12:37 
Write a program that determines a student's grade. It reads three test scores(between 0 and 100) and calls a function that calculates and returns a student's grade based on the following rules:
A. If the average score is 90% or more, the grade is A.
B. If the average score is 70% or more and less than 90%, it checks the third score. If the third score is more than 90%, the grade is A; otherwise, the grade is B.
and it continues...

The program's main is to contain only call statements. At least three subfunctions are required: one to read scores, one to determine the grade, and one to print the results.

This is what I have so far but it will not run for me. I am not allowed to use global declarations.

C#
#include <stdio.h>

//      Function Declarations

int main (void)
{
//      Local Declarations
        int  score1, score2, score3;
        char grade;
		int temp = 0;
		

//      Statements
        printf("Enter the test score (0-100): ");
        scanf ("%d", &score1);
		printf("Enter the test score (0-100): ");
        scanf ("%d", &score2);
		printf("Enter the test score (0-100): ");
        scanf ("%d", &score3);
		
        
        printf("The grade is: %c\n", score1, score2, score3);

        return 0;
}       // main

/*      =================== scoreToGrade ===================
        This function calculates letter grade for a score.
           Pre   the parameter score
           Post  returns the grade
*/

//      Local Declarations
int temp = 0;
{        
		temp = (score1+score2+score3)/3;

//      Statements
        if (score >= 90)
           grade = 'A';
        else
                if (score >= 80)
                        grade = 'B';
                else
                        if (score >= 70)
                                grade = 'C';
                        else
                                if (score >= 60)
                                        grade = 'D';
                                else
                                        grade = 'F';

   char grade;
 
//      Statements
        if (score >= 90)
           grade = 'A';
        else
                if (score >= 80)
                        grade = 'B';
                else
                        if (score >= 70)
                                grade = 'C';
                        else
                                if (score >= 60)
                                        grade = 'D';
                                else
                                        grade = 'F';
        return grade;
}       // scoreToGrade



help please
AnswerRe: C programming Determine Students grade Pin
leon de boer9-Nov-16 14:27
leon de boer9-Nov-16 14:27 
QuestionHow explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
Amrit Agr6-Nov-16 22:06
Amrit Agr6-Nov-16 22:06 
AnswerRe: How explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
Richard MacCutchan7-Nov-16 0:18
mveRichard MacCutchan7-Nov-16 0:18 
AnswerRe: How explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
leon de boer7-Nov-16 8:15
leon de boer7-Nov-16 8:15 
GeneralPlease help Pin
Ahmed Adel5-Nov-16 3:20
Ahmed Adel5-Nov-16 3:20 
GeneralRe: Please help Pin
Richard MacCutchan5-Nov-16 21:01
mveRichard MacCutchan5-Nov-16 21:01 
GeneralRe: Please help Pin
leon de boer6-Nov-16 4:49
leon de boer6-Nov-16 4:49 
PraiseRe: Please help Pin
Ahmed Adel6-Nov-16 5:10
Ahmed Adel6-Nov-16 5:10 
QuestionPattern review C++: using structs with pure virtual methods in place of interfaces Pin
Member 128328324-Nov-16 5:58
Member 128328324-Nov-16 5:58 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Chris Losinger4-Nov-16 8:23
professionalChris Losinger4-Nov-16 8:23 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
leon de boer4-Nov-16 8:48
leon de boer4-Nov-16 8:48 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
«_Superman_»5-Nov-16 21:42
professional«_Superman_»5-Nov-16 21:42 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Daniel Pfeffer6-Nov-16 0:35
professionalDaniel Pfeffer6-Nov-16 0:35 
QuestionMouse out of dialog Pin
_Flaviu3-Nov-16 4:07
_Flaviu3-Nov-16 4:07 
AnswerRe: Mouse out of dialog Pin
leon de boer3-Nov-16 4:21
leon de boer3-Nov-16 4:21 
QuestionRe: Mouse out of dialog Pin
David Crow3-Nov-16 15:42
David Crow3-Nov-16 15:42 
AnswerRe: Mouse out of dialog Pin
_Flaviu3-Nov-16 21:44
_Flaviu3-Nov-16 21:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.