78 494
Assignments Done
99,5%
Successfully Done
In September 2019

# 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
/*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!