#include<iostream> using namespace std; int num(int n) { cout<<"num of chocolate:"; cin>>n; return n; } int ounce(int a) { cout<<"weight in ounce:"; cin>>a; return a; } int pound(int b) { cout<<"weight in pound:"; cin>>b; return b; } int main () { int n, a, b; char choice; cout<<"enter choice 'o' for ounce and 'p' for pounds:"; cin>>choice; int x, y, z; x = num(n); y = ounce(a); z = pound(b); if (choice == 'o') {cout<<"total weight in ounce:"<<x*y;} if (choice == 'p') {cout<<"total weight in pounds:"<<x*z;} return 0; } ************************** Output:
Educational Material, Computer Languages, Programs, Physics, Science, Chemistry, Professional Education,
Comments
Post a Comment