write a program and print salesman of the month using structure in c++


print salesman of the month using structure in c++ Simple Example

#include <iostream> #include <iomanip> #include <string> using namespace std; struct Representative { string name; double sales; }; inline void print( const Representative& v) { cout << fixed << setprecision(2) << left << setw(20) << v.name << right << setw(10) << v.sales << endl; } int main() { Representative rita, john; rita.name = " Rita"; rita.sales = 37000.37; john.name = " John"; john.sales = 23001.23; rita.sales += 1700.11; // More Sales cout << " Representative Sales\n" print( rita); print( john); cout << "\nTotal of sales: " << rita.sales + john.sales << endl; Representative *ptr = &john; if( john.sales < rita.sales) ptr = &rita; cout << "\nSalesman of the month: " << ptr->name << endl; = return 0; }