62 556
Assignments Done
98,8%
Successfully Done
In June 2018

Answer to Question #25833 in C++ for amber barnes

Question #25833
write the c++ code to display the message " Entry error" when the value in the units variable is less than or eqaul to 0. Otherwise, calculate the total owed by multiplying the units variable value by 5. Store the total owed in the toatal variable, and then display the total owed
Expert's answer
/*write the c++ code to display the message " Entry error" when the value in
the units variable is less than or equal to 0. Otherwise, calculate the
total owed by multiplying the units variable value by 5. Store the total
owed in the total variable, and then display the total owed*/

# include <iostream>

using namespace std;

int main(){

while(true){
int tot=0;
cout<<"Enter value:";
int n;
cin>>n;
if (n<=0) {cout<<"error\n";cout<<"Total:"<<tot<<endl; system("PAUSE");return 0;}
else{
tot+=n*5;


}
}

system("PAUSE");
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions