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
1
Expert's answer
2013-03-12T12:51:00-0400
/*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;
Comments
Leave a comment