Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
890 B
3
Indexable
Never
#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;
}