My shop price calculator
Here I have made a simple price calculator using an infinite while loop (true),
here I have written the source code;
#include<iostream>
using namespace std;
int main(){
int price;
int sum =0;
cout<<"Welcome to My Price Claculator"<<endl;
while (true)
{
if(price == 0 ){
cout<<"Thank you for using our price calculator:\n";
cout<<"Total amout is: "<<sum;
break;
}
else{
cout<<"Enter the price ";
cin>>price;
cout<<endl;
sum = sum + price;
}
}
return 0;
}
0 Comments