0

Write a C++ to design employee class for reading and displaying the employee information. the getinfo) and displayinfo() method

c++

12th Jul 2021, 3:12 PM
Saurabh Kahar
17 Answers
+ 2
"Unfortunately, the Indian board of uneducation still insists on using this 16-bit ms-dos dinosaur' Martin Taylor some of them have transitioned to python and according to new board standards, coding is now to be forced to learn in 6th grade (some of you reading might think it's good idea but remember, programming isn't for everyone)
13th Jul 2021, 9:17 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 2
Thought this thread would fit here, seeing that there's a discussion on Turbo C/C++. https://www.sololearn.com/Discuss/288609/?ref=app
14th Jul 2021, 7:04 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Hi, please show your attempt and link your code here.
12th Jul 2021, 3:24 PM
Lisa
Lisa - avatar
+ 1
I barely know any cpp, but I managed to make it run on playground: https://code.sololearn.com/c02SnClJF8GD/?ref=app Basically, your class seems complete, but the playground doesn't have a conio.h, I guess, so I commented it out for testing. Some things: * I changed main() to return int, I don't know if this is a requirement. * I commented getchar(), don't know what you wanted to do with it * please, next time, put your code in a playground script with some formatting
12th Jul 2021, 4:18 PM
Lisa
Lisa - avatar
+ 1
1. It's <iostream>, not <iostream.h> 2. From Wikipedia, https://en.m.wikipedia.org/wiki/Conio.h: "conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output. It is not part of the C standard library or ISO C, nor is it defined by POSIX. " Emphasis on "it is not a part of the C standard" and "not defined by POSIX". In short, <conio.h> is an old header file not used or available anymore (it was never in linux AFAIK). Both clrscr() and getch() are defined in <conio.h> and are thus, not available. Please for god's sake, just let <conio.h> go. Why are there so many questions regarding the same problem? Who is teaching conio.h? 3. There is a string class in C++. There is no reason for using character arrays in C++ https://www.cplusplus.com/reference/string/string/ 4. Return type of main() should be int. Keeping it as void does not give error (atleast on the GNU compiler) as the compiler changes it to int, but you should *always* keep it as imt.
12th Jul 2021, 5:22 PM
XXX
XXX - avatar
+ 1
XXX teachers don't update that "fast", I guess 😁
12th Jul 2021, 5:24 PM
Lisa
Lisa - avatar
+ 1
@Martin Taylor, Python is being taught only in schools, that too in the CBSE board. The CISCE board teaches Java. Teaching Python is still bad, but here in India, we hardly learn any programming in school. We do learn, but most students take it as the "subject in which I can score marks easily", which is one of the reasons you see so many school kids asking for solutions to problems in Java/Python As for the universities, I don't know if there is any national board that prescribes the syllabus (I've never heard of it, but there could be). Which is tje reason I doubt Turbo C is being taught in most colleges. That's atleast what I think, considering I've never been in a college as I'm not at that stage of life yet. I've only talked to one Computer Science student in my life, and if I remember correctly, he mentioned that he mostly uses Java in college (can't say anything for sure since we talked about programming for like 5 minutes)
14th Jul 2021, 3:15 AM
XXX
XXX - avatar
+ 1
@Martin Taylor, There are certainly some universities that do teach Turbo C though, considering the number of Indians asking questions related to Turbo C, and it's really a sad thing because mordern C++ is so much more mature and they should be learning that. Problem is, most people don't even realise they are being taught the wrong things as they've never worked in C++ before. Also, "Indian board of *uneducation*" was genius lol!
14th Jul 2021, 3:19 AM
XXX
XXX - avatar
0
Lisa means i didn't understand what you want to say??
12th Jul 2021, 3:26 PM
Saurabh Kahar
0
I mean: What did you do so far? Where is your code?
12th Jul 2021, 3:28 PM
Lisa
Lisa - avatar
0
ohk i didn't try 😅
12th Jul 2021, 3:28 PM
Saurabh Kahar
0
ohk but i will send you some vode related to this
12th Jul 2021, 3:29 PM
Saurabh Kahar
0
Then try it yourself first and come back to this thread :)
12th Jul 2021, 3:29 PM
Lisa
Lisa - avatar
0
# include <iostream.h> # include <conio.h> class employee { private: int emp_id; char emp_name[30]; double salary; void getinfo() { cout<<"Enter Name"<<endl; cin>>emp_name; cout<<"Enter ID"<<endl; cin>>emp_id; cout<<"Enter salary"<<endl; cin>>salary; } public: void displayinfo() { getinfo(); cout<<endl<<"THE INFORMATION ENTERED IS :"<<endl; cout<<"Name is "<<emp_name<<endl; cout<<"ID is "<<emp_id<<endl; cout<<"Your salary is "<<salary<<endl; } }; void main() { clrscr(); employee e1; e1.displayinfo(); getch(); }
12th Jul 2021, 3:29 PM
Saurabh Kahar
0
Don't send it to me, link it here, please :)
12th Jul 2021, 3:30 PM
Lisa
Lisa - avatar
0
Martin Taylor thanks: if you hadn't told me I wouldn't even have noticed that it isn't c++! My attempt was a shot in the dark.
13th Jul 2021, 9:03 AM
Lisa
Lisa - avatar
0
Vikash Roy Sololearn is a learning platform. We are not doing your homework for you. If you have an actual QUESTION create your own thread, please.
23rd Apr 2023, 9:52 AM
Lisa
Lisa - avatar