Untitled
unknown
c_cpp
3 years ago
890 B
5
Indexable
#include <iostream> using namespace std; #define x 3 class karmand { char name[10]; int ab; int hour; long int salary; public: void input(); void cal(); void output(); }; void karmand::input() { cout << "enter thr name :" << endl; cin >> name; cout << "enter thr hour :" << endl; cin >> hour; cout << "enter thr dastmozd :" << endl; cin >> ab; } void karmand::cal() { salary = hour * ab; } void karmand::output() { cout << name << "\t" << hour << "\t" << "salary is:" << salary << endl; } void getList(karmand list[]) { for (int i = 0; i < x; ++i) list[i].input(); } void calList(karmand list[]) { for (int i = 0; i < x; ++i) list[i].cal(); } void outList(karmand list[]) { for (int i = 0; i < x; ++i) list[i].output(); } int main() { karmand list[x]; getList(list); calList(list); outList(list); return 0; }
Editor is loading...