0
class item { public: string name; string code; double price; }; class buyer { public: string name; int count; }; #include<string> #include<iostream> using namespace std; int main() { item item1; buyer buyer1,buyer2; double sum1,sum2,sumTotal; cout<<"enter name, code and price of item:"<<endl; cin>>item1.name>>item1.code>>item1.price; // The data for the first buyer cout <<"Enter name and count of first buyer:"<<endl; cin >> buyer1.name>>buyer1.count; // The data for the second buyer cout <<"Enter name and count of second buyer:"<<endl; cin >> buyer2.name>>buyer2.count; // Displaying of initial values cout << "Initial data:" << endl; cout << "Item " << item1.name << ", code " << item1.code << ", price " << item1.price << endl; cout << "The first buyer" << buyer1.name << ", bought " << buyer1.count << endl; cout << "The second buyer" << buyer2.name << ", bought " << buyer2.count << endl; // Calculations sum1 = item1.price * buyer1.count; sum2 = item1.price * buyer2.count; sumTotal = sum1 + sum2; // Displaying of results cout << "Results:" << endl; cout << "The first buyer spend " << sum1 << " Lt" << endl; cout << "The second buyer spend " << sum2 << " Lt" << endl; cout << "The total sum" << sumTotal << " Lt" << endl; return 0; }
Edited 1 Year Ago by kumanutiw: just misprint