Hi,
i am new to cprogramming and i want to do this thing. all in all i have 2 problems
1)how do you add answers?
Code:A+B=ans1 C+D=ans2 ans1+ans2=ans3//i cant do this part
2)Next problem is that i cant add switches is there something i am doing wrong?
i wanted to add cases.
Code:#include <cstdlib> #include <iostream> using namespace 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, product B is 20, product C is 30 printf("total amout due is: %lf \n", total); printf("enter amount paid by customer: \n"); cin>>cash; do{ change=total-cash;\\still not working printf("total change will be: \n", change); } while(total>=cash); system("PAUSE"); return EXIT_SUCCESS; }



LinkBack URL
About LinkBacks


