#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(int argc, char *argv[])
{
int A,B,C;
double total;
int cash,product;
double change;
switch (product){
case 1:
printf("how many product A: \n");
cin>>A;
break;
case 2:
printf("how many product B: \n");
cin>>B;
break;
case 3:
printf("how many product C: \n");
cin>>C;
break;
}
total=(case 1*10)+(case 2*20)+(case 3*30);
\\ unit price of product A is 10
printf("total amout due is: %lf \n", total);
Another problem of mine is that i cant add answer with another answer
1 2 3 4 5 6 7 8 9
printf("enter amount paid by customer: \n");
cin>>cash;
do{
change=total-cash;
printf("total change will be: \n", change);
}
while(total>=cash);
I'm not entirely sure what you're trying to do. What do you mean by 'add switches'? You can add the values in the variables used in the switches, is that what you mean?
The printf() function is a C function. For c++, you would use something like: cout << "Total change will be: " << change;