Question: Consider the following C + + code: / / This C + + program prints You Pass if a student's average is / / 6
Consider the following C code:
This C program prints "You Pass" if a student's average is
or higher and prints "You Fail" otherwise
#include
using namespace std;
int main
float average; holds the grade average
cout "Input your average:" endl;
cin average;
if average
cout "You Pass" endl;
if average
cout "You Fail" endl;
return ;
Exercise : Use ifelseif statement to modify the C program above to allow the following categories: Invalid data data above A category B category You Pass category You Fail category Save the C program as Labpacpp
Part : Use nested if statements to rewrite your C program in exercise Save the program as Labpbcpp
Part : Use logical operators to connect more than one relational expression to rewrite your C program in exercise Save the C program as Labpccpp
Consider the following code:
This program prints "You Pass" if a student's average is
or higher and prints "You Fail" otherwise
#include
using namespace std;
int main
l
float average; holds the grade average
cout "Input your average:" endl;
cin gg average;
if average
cout "You Pass" endl;
if average
cout "You Fail" endl;
return ;
Exercise : Use ifelseif statement to modify the program above to allow the following categories:
Invalid data data above A category B category "You Pass" category
"You Fail" category
Save the program as Labpacpp
Use nested if statements to rewrite your program in exercise
Save the program as Labpbcpp
Use logical operators to connect more than one relational expression to rewrite your program in
exercise
Save the C program as Labpccpp
Submit all programs to Brightspace under Lab Assignment
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
