Answer to Question #172154 in C++ for Boopathi

Question #172154

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-17T00:33:52-0400
#include <iostream>



void print_status(int cpga)

{

  if ( cpga < 50 )

  {

    std::cout << "FAIL" << std::endl;

  }

  else if ( cpga >= 50 && cpga <= 60 )

  {

    std::cout << "FIRST" << std::endl;

  }

  else if ( cpga > 60 && cpga <= 70 )

  {

    std::cout << "SECOND" << std::endl;

  }

  else if ( cpga > 70 && cpga <= 80 )

  {

    std::cout << "THIRD" << std::endl;

  }

  else if ( cpga > 80 )

  {

    std::cout << "DISTINCTION" << std::endl;

  }

}



int main()

{

  int cpga;



  std::cout << "Enter CGPA: ";

  std::cin >> cpga;

  print_status( cpga );

   

  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