in a class i dont really know too much
im stuck on the part about constuctor and destucton and how to call a function from in a class
or example i have a code i started and i want to make a class the declaers variebles than has a funtion in it.
i have the funtion asking for some data than i want to have another funtion in it that uses the data.. and i got really lost.
i have posted what i have done so far but i think its really off and it isnt done so pls dont post about that being something wrong..
Code:#include <iostream> using namesspace std; class database { public: int employee; float salery; int position; int x; void position (int rank) { switch (rank) { case 1: cout<<"cashier"; break; case 2: cout<<"Bag boy"; break; case 3: cout<<"delly"; break; case 4: cout<<"janeter"; break; case 5: cout<<"banker"; break; case 6: cout<<"produce"; break; case 7: cout<<"vice-maneger"; break; case 8: cout<<"maneger"; break; case 10: cout<<"1) cashier \n2) bag boy \n3) delly \n4) janeter \n5) banker \n"; cout<<"6) produce \n7) vice-maneger \n8) maneger \n"; cin>> rank; position (rank); break; default: cout<<"not in database"; break; } } void quarry () { cout<<"Employee id number?"<<endl; cin>> id_number; cout<<"The salery of employee :"<< id_number<<endl; cin>> salery; cout<<"The current status of employee? 10 for listings"<<endl; cin>> rank; } void respond () { cout<<"employee id number is :"<<idnumber<<endl; cout<<"employee salery :"<<salery<<" per hour"<<endl; cout<<"your employee's position is :"; position (rank); cout<<endl; } }; int main() {



LinkBack URL
About LinkBacks



osition (int rank) { }, however you could define them inside the class if they were inline, but I dont think that would work with the code you want to have here, or would it be efficient.