0

C++ project need help ASAP

https://drive.google.com/file/d/1jvrO_gRFyoi0gVTM8ZXR-B1OOzHnlJNi/view?usp=sharing #include<iostream> #include<iomanip> using namespace std; int count; struct info { double yTax; double priceIY; double priceEY; double gst; double priceGST; double DifferencePrice; }; double Calculate(double&); double Calculate(double &a,double &b,double &c ) { info a; a=S.priceEY=S.priceIY*(1.00-0.05); a=S.priceGST=S.priceEY(1.00+0.06); a=S.DifferencePrice=S.priceGST-S.priceIY; return a; } { info b='P'; P.priceEY=P.priceIY*(1.00-0.05); P.priceGST=P.priceEY(1.00+0.06); P.DifferencePrice=P.priceGST-P.priceIY; return Calculate; } { info c='Z'; Z.priceEY=Z.priceIY*(1.00-0.05); Z.priceGST=Z.priceEY(1.00+0.06); Z.DifferencePrice=Z.priceGST-Z.priceIY; return Calculate; } int main() { struct info S, P, Z; char lable; int n; cout<<"Enter the number of data you want to enter or '-1' to exit:"; cin>>n; if(n == -1){ cout<<"You exited!"; return n; } for(int i=0;i<n;i++) { cout<<"Enter a lable or 'N' to exit : "; cin>>lable; if (lable == 'S' || lable == 's') { cout << "Item price: RM"; cin >>S.priceIY; } else if (lable == 'P' || lable == 'p') { cout << "Item price: RM"; cin >>P.priceIY; } else if (lable == 'Z' || lable == 'z') { cout << "Item price: RM"; cin >>Z.priceIY; } else if (lable == 'N' || lable == 'n') break; else cout << "Invalid item label!" << endl; } return 0; }

10th Oct 2018, 11:55 AM
Leon S Han 拇靱
Leon S Han 拇靱 - avatar
2 RĂ©ponses