Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- class Student{
- public:
- long long int Roll;
- std:: string name;
- float Marks;
- void GetData();
- void Display();
- };
- void Student::GetData()
- {
- cout<<"Enter Roll : ";
- cin>>Roll;
- cout<<"Enter name : ";
- cin.getline(name,40);//getline(cin,name);
- cout<<"Enter Marks : ";
- cin>>Marks;
- }
- void Student::Display()
- {
- GetData();
- cout<<"\nRoll is : "<<Roll<<endl;
- cout<<"name is : "<<name<<endl;
- cout<<"Marks is : "<<Marks<<endl;
- if(Marks<0)
- cout<<"invalid Marks!"<<endl;
- }
- int main()
- {
- Student s;
- s.Display();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement