fork download
  1. #include<iostream>
  2. #include<conio.h>
  3. #include<iomanip>
  4. class Employee
  5. {
  6. private:
  7. int empcode;
  8. char empname[10];
  9. public:
  10. void getdata();
  11. void display();
  12. };
  13. void Employee::getdata()
  14. {
  15. cout<<"Name "<<endl;
  16. cin>>empname;
  17. cout<<"Code"<<endl;
  18. cin>>empcode;
  19. }
  20. void Employee::display()
  21. {
  22. cout<<endl<<setw(20)<<empname<<setw(10)<<empcode;
  23. }
  24. int main()
  25. {
  26. Employee Emp[6];
  27. clrscr();
  28. cout<<"Enter employee details "<<endl;
  29. for(int i=0; i<6; i++)
  30. {
  31. cout<<" Employee "<<i+1<<endl;
  32. Emp[i].getdata();
  33. }
  34. cout<<"Employee details are as follows : "<endl;
  35. cout<<endl<<setw(20)<<"NAME"<<setw(10)<<setiosflags(ios::right)<<"CODE";
  36. cout<<"\n--------------------";
  37. for (i=0; i<6;i++)
  38. Emp[i].display();
  39. getch();
  40. return 0;
  41. }
  42.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:18: fatal error: conio.h: No such file or directory
 #include<conio.h>
                  ^
compilation terminated.
stdout
Standard output is empty