using switch and if ... else statements, write the two grading programs. consider the following grading system;

70-100 A
60-69 B
50-59 C
40-49 D
0-39 F

Recommended Answers

All 6 Replies

write the two grading programs.

You would probably learn more if you wrote them yourself :icon_wink:

if you're planning to do it with switch it will be a pain

#include <iostream>

using namespace std;

int main ()
{
    int i;
    cout<<"Sigh ";cin>>i;cout<<endl<<"Answer : ";
    if(i>=70 && i<=100)cout<<"A";
    if(i>=60 && i<=69)cout<<"B";
    if(i>=50 && i<=59)cout<<"C";
    if(i>=40 && i<=49)cout<<"D";
    if(i>=0 && i<=39)cout<<"F";
    if(i<0 || i>100)cout<<"Not Good";

}
commented: Don't hand out code willy-nilly, it's counter productive and against forum rules. +0

if you're planning to do it with switch it will be a pain

#include <iostream>

using namespace std;

int main ()
{
    int i;
    cout<<"Sigh ";cin>>i;cout<<endl<<"Answer : ";
    if(i>=70 && i<=100)cout<<"A";
    if(i>=60 && i<=69)cout<<"B";
    if(i>=50 && i<=59)cout<<"C";
    if(i>=40 && i<=49)cout<<"D";
    if(i>=0 && i<=39)cout<<"F";
    if(i<0 || i>100)cout<<"Not Good";

}

I suggest you read the forum rules. :icon_evil:
As well as this announcement.

damn . i am sorry won't happen again

Don't misunderstand, it's okay to post up code for the OP, but don't make it so complete/accurate that they can simply cut/paste it. It is better to post something similar that properly demonstrates a beneficial concept.

Don't misunderstand, it's okay to post up code for the OP, but don't make it so complete/accurate that they can simply cut/paste it. It is better to post something similar that properly demonstrates a beneficial concept.

Okay i will remember that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.