Answer to Question #173440 in C++ for JOTHIBASS S

Question #173440

Develop a C++ program to get the CGPA and print the following status according to the given CGPA by using else if ladder statement. [Note: Use call by value]


1. CGPA < 50 "FAIL"


2. 50 >= CGPA <=60 "FIRST"


3. 60 > CGPA <=70 "SECOND"


4. 70 > CGPA <=80 "THIRD"


5. CGPA >80 "DISTINCTION


1
Expert's answer
2021-03-21T04:46:38-0400
#include <iostream>

void Print(int ggpa) {
    if(ggpa < 50) {
        std::cout << "FAIL\n";
    }
    else if(ggpa <= 60) {
        std::cout << "FIRST\n";
    }
    else if(ggpa <= 70) {
        std::cout << "SECOND\n";
    }
    else if(ggpa <= 80) {
        std::cout << "THIRD\n";
    }
    else {
        std::cout << "DISTINCTION\n";
    }
}

int main() {
    int ggpa = 0;
    std::cin >> ggpa;
    Print(ggpa);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS