#include <iostream>
#include <string>
using namespace std;
class Teacher{
private:
int number;
string name;
double salary;
public:
//Accept the details of a teacher
void get(){
cout<<"Enter a teacher number: ";
cin>>number;
cin.ignore();
cout<<"Enter a teacher name: ";
getline(cin,name);
cout<<"Enter a teacher salary: ";
cin>>salary;
}
//Display the details of a teacher
void display(){
cout<<"The teacher number: "<<number<<"\n";
cout<<"The teacher name: "<<name<<"\n";
cout<<"The teacher salary: "<<salary<<"\n";
}
};
int main(){
int N;
Teacher Teacher;
Teacher.get();
Teacher.display();
cin>>N;
return 0;
}
Comments
Leave a comment