-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10.cpp
More file actions
32 lines (27 loc) · 658 Bytes
/
Copy path10.cpp
File metadata and controls
32 lines (27 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//WAP create a class student take public data members roll no, name & age and enter these data from main function.
#include<iostream>
#include<string>
using namespace std;
class students
{
public:
string Name;
int rollno;
int age;
void displaydata()
{
cout<< "\nStudent Roll No.: "<<rollno << "\nStudent Name: "<<Name << "\nStudent Age: "<<age;
}
};
int main()
{
students one;
cout<< "Enter Student Roll No.: ";
cin>> one.rollno;
cout<< "Enter Student Name: ";
cin>> one.Name;
cout<< "Enter Student Age: ";
cin>> one.age;
one.displaydata();
return 0;
}