iam stuck at output :(

i want to formate the output of this program but iam failed plzz someone help me
iam trying to get output like this but i can't :(





Data: 
Manager 1:						Manager 2:		
1.	ID Number					     1. ID Number
2.	Name						     2. Name
3.	Title						     3. Title 
4.	Golf club dues				             4. Golf club dues	

scientist:					            Laborer:
1.	ID Number					     1. ID Number
2.	Name						     2. Name
3.	Number of publications	










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
using namespace std;
const int LEN = 80; 
class employee 
{
private:
char name[LEN]; 
unsigned long number; 
public:
void getdata()
{
cout << "\n Enter last name: "; cin >> name;
cout << " Enter number: "; cin >> number;
}
void putdata() const
{
cout << "\n Name: " << name;
cout << "\n Number: " << number;
}
};

class manager : public employee 
{
private:
char title[LEN]; 
double dues; public:
void getdata()
{
employee::getdata();
cout << " Enter title: "; cin >> title;
cout << " Enter golf club dues: "; cin >> dues;
}
void putdata() const
{
employee::putdata();
cout << "\n Title: " << title;
cout << "\n Golf club dues: " << dues;
}
};
class scientist : public employee 
{
private:
int pubs; 
public:
void getdata()
{
employee::getdata();
cout << " Enter number of pubs: "; cin >> pubs;
}
void putdata() const
{
employee::putdata();
cout << "\n Number of publications: " << pubs;
}
};
class laborer : public employee 
{

	};
main()
{
manager m1, m2;
scientist s1;
laborer l1;
cout << endl; 
cout << "\nEnter data for manager 1";
m1.getdata();
cout << "\nEnter data for manager 2";
m2.getdata();
cout << "\nEnter data for scientist 1";
s1.getdata();
cout << "\nEnter data for laborer 1";
l1.getdata();

cout << "\nData on manager 1";
m1.putdata();
cout << "\nData on manager 2";
m2.putdata();
cout << "\nData on scientist 1";
s1.putdata();
cout << "\nData on laborer 1";
l1.putdata();
cout << endl;

}
Since you're working in console, using the <iomanip> header should provide some functions that should help.

Aceix.
@aciex i tried Iomainp but iam failed..


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include<iomanip>
using namespace std;
const int LEN = 80; 
class employee 
{
private:
char name[LEN]; 
unsigned long number; 
public:
void getdata()
{
cout << "\n Enter last name: "; cin >> name;
cout << " Enter number: "; cin >> number;
}
void putdata() const
{
cout << setw(30)<<"\n Name: " << name;
cout << setw(80)<<"\n Number: " << number;
}
};
class manager : public employee 
{
private:
char title[LEN]; double dues; 
public:
void getdata()
{
employee::getdata();
cout << " Enter title: "; cin >> title;
cout << " Enter golf club dues: "; cin >> dues;
}
void putdata() const
{
employee::putdata();
cout << setw(30)<< "\n Title: " << title;
cout << setw(30)<< "\n Golf club dues: " << dues;
}
};
class scientist : public employee {
private:
int pubs; 
public:
void getdata()
{
employee::getdata();
cout << " Enter number of pubs: "; cin >> pubs;
}
void putdata() const
{
employee::putdata();
cout << setw(30)<< "\n Number of publications: " << pubs;
}
};

class laborer : public employee {

	};
main()
{
manager m1, m2;
scientist s1;
laborer l1;
cout << endl; cout << "\nEnter data for manager 1";
m1.getdata();
cout << "\nEnter data for manager 2";
m2.getdata();
cout << "\nEnter data for scientist 1";
s1.getdata();
cout << "\nEnter data for laborer 1";
l1.getdata();
cout << "\nData on manager 1";
m1.putdata();
cout << "\nData on manager 2";
m2.putdata();
cout << "\nData on scientist 1";
s1.putdata();
cout << "\nData on laborer 1";
l1.putdata();
cout << endl;

}
Topic archived. No new replies allowed.