0

Can anyone solve this error regarding c++?

# include <iostream.h> # include <conio.h> # include <stdio.h> struct employee { int eno; char name[20]; float salary; }; void display (employee e[50],int ); void add(employee e[50],int &); void del(employee e[50],int &); void modify (employee e[50],int &); void main() { employee e[50]; int n,x; cout<<"ENTER LIMIT -"; cin>>n; for(int i=0;i<n;i++) { cout<<"enter employee number"; cin>>e[i].eno; cout<<"enter the name"; gets(e[i].name); cout<<"enter salary"; cin>> e[i].salary; } while(i) { cout<<"main menu"; cout<<"1) display"; void add(employee e[50],int &n) { cout<<"enter number"; cin>>e[n].eno; cout<<"enter name"; gets(e[n].name); cout<<"enter salary"; cin>>e[n].salary; n++; } void del(employee e[50],int &n) { int emp; cout<<"enter the employee id that you want to delete = "; cin>>emp; for(int i=0;i<n;i++) { if (e[i].eno==emp) { for (int j=i;j<n-1;j++) e[j]=e[j+1]; break; } } n--; } void modify(employee e[50], int &n) { int x,sal; cout<<"2) Add"; cout<<"3) delete"; cout<<"4) modify"; cout<<"5) exit"; cout<<"enter your choice "; cin>>x; switch(x) { case 1:display (e,n); break; case 2: add(e,n); break; case 3:del(e,n); break; case 4:modify(e,n); break; case 5:exit(0); break; default:cout<<"INVALID CHOICE"; break; void display(employee e[50],int n); { for(int i=0;i<n;i++) { cout<<"Employee code"<<e[i].eno; cout<<"Employee name"<<e[i].name; cout<<"Employee salary"<<e[i].salary; } cout<<"Enter the eno & new salary"; cin>>x>>sal; for(int i=0;i<n;i++) { if(e[i].eno==x) { e[i].salary=sal; break; } } getch(); }

1st Jan 2019, 2:51 PM
Samyak Sand
Samyak Sand - avatar
1 Odpowiedź
+ 1
You are using non-standard C++ so it won't run in SoloLearn playground. conio.h is a Turbo C++ only include. The other two includes need to have the '.h' removed. stdio must become cstdio. The getch() call at the end will not work here as well.
5th Jan 2019, 3:33 AM
John Wells
John Wells - avatar