hey .. please i need help with this code when i write it and i start in case 3 .. i've error massage .. illegal case .. why is that ?
[LIST=1]
[*]#include <iostream>
[*]#include <string>
[*]using namespace std ;
[*]class employee
[*]{
[*]private:
[*] string name;
[*] int salary;
[*] char degree;
[*] int id;
[*] long nr;
[*]public:
[*] employee(){
[*] name=" ";
[*] degree=' ';
[*] salary=0;
[*] id=0;
[*] nr=0;}
[*] void AddNewEmployee(string n,int s,char d,int id1,long nr1){
[*] name=n;
[*] salary=s;
[*] degree=d;
[*] id=id1;
[*] nr=nr1;}
[*] string getname(){ return name;}
[*] char getde(){ return degree;}
[*] int getsa(){ return salary;}
[*] int getidnu(){ return id;}
[*] long getnrnum(){ return nr;}
[*]};
[*]int main(){
[*]string n;
[*]char d;
[*]int s;
[*]int id1;
[*]long nr1;
[*]int choise;
[*]const int size = 1;
[*]employee em[size];
[*]int i,j;
[*]do{
[*]cout<<"\n*********************************************"<<endl;
[*]cout<<"------------------Welcome To ABC Company --------------"<<endl;
[*]cout<<"Main Menu:"<<endl;
[*]cout<<"1. Add a new employee."<<endl;
[*]cout<<"2. Edit employee information."<<endl;
[*]cout<<"3. Find employee."<<endl;
[*]cout<<"4. Remove employee."<<endl;
[*]cout<<"5. Print employee(s) information."<<endl;
[*]cout<<"6. Sort company list"<<endl;
[*]cout<<"7. Exit"<<endl;
[*]cout<<"*********************************************"<<endl;
[*]cin>>choise;
[*]switch(choise)
[*]{
[*]case 1:{
[*] string key = "y";
[*] while( key == "y" || key == "Y"){
[*] cout<<"\n*********************************************"<<endl;
[*] cout<<"----------- ABC Company >> Add a new employee.."<<endl;
[*] for(i=0; i<size;i++){
[*] cout<<"\nID: ";
[*] cin>>id1;
[*] cout<<"\nNR: ";
[*] cin>>nr1;
[*] cout<<"\nName: ";
[*] cin>>n;
[*] cout<<"\nDegree:m for Manager - s for Secretary - l for Labor : ";
[*] cin>>d;
[*] switch(d)
[*] {
[*] case 'm' :
[*] s=10000;
[*] break;
[*] case 's' :
[*] s=5000;
[*] break;
[*] case 'l' :
[*] s=4200;
[*] break;
[*] default: cout<<"wrong degree ";
[*] break;}
[*] cout<<"\nSalary: "<<s <<"\n";
[*] em[i].AddNewEmployee(n,s,d,id1,nr1);}
[*] cout << "\n*********************************************";
[*] cout << "\nDo you want to add more (y/n)? ";
[*] do{getline( cin, key);}while( key != "y" && key != "Y" && key != "n" && key != "N");
[*] cout << "*********************************************";
[*] }}
[*] break;
[*]case 2:
[*]int inf;
[*]int edit;
[*]int empid;
[*]string n_ed;
[*]char d_ed;
[*]string key = "y";
[*]while( key == "y" || key == "Y"){
[*]cout<<"------ ABC Company >> Edit an employee information.."<<endl;
[*]cout<<"Please enter employee ID: ";
[*]cin>>empid;
[*]for ( j=0 ; j<size ; j++){
[*] if ( em[j].getidnu() == empid ){
[*] inf=j;
[*] cout<<"\nWhat do you want to edit? "<<endl;
[*]cout<<"\n1. Name : "<< em[inf].getname()<<endl;
[*]cout<<"\n2. Degree: "<< em[inf].getde()<<endl;
[*]cin>>edit;
[*]switch(edit)
[*]{
[*]case 1 :
[*]cout<<"Name:";
[*]cin>>n_ed;
[*]em[inf].AddNewEmployee(n_ed,s,d,id1,nr1);
[*]break;
[*]case 2 :
[*]cout<<"Degree: ";
[*]cin>>d_ed;
[*]em[inf].AddNewEmployee(n,s,d_ed,id1,nr1);
[*]break;
[*]default: cout<<" wrong choise "; break;}
[*]break;}}
[*]cout << "\n*********************************************";
[*] cout << "\nDo you want to edit another one information (y/n)? ";
[*] do{getline( cin, key);}while( key != "y" && key != "Y" && key != "n" && key != "N");
[*] cout << "*********************************************";}}
[*]case 3 :
[*] cout<<"i've got error here .. why?"; //error
[*]}while (choise != 7);
[*] return 0;
[*]}
[/LIST]
thanx