Program 2
Program 2
#include<iostream>
using namespace std;
class Student {
private:
string name;
int age;
string rollNumber;
string course;
string address;
public:
// Method to input student details
void inputData() {
cout << "Enter Name: ";
cin>>name;
//getline(cin, name);
cout << "Enter Age: ";
cin >> age;
//cin.ignore(); // To ignore the newline character from previous input
cout << "Enter Roll Number: ";
cin>>rollNumber;
//getline(cin, rollNumber);
cout << "Enter Course: ";
cin>>course;
//getline(cin, course);
cout << "Enter Address: ";
cin>>address;
//getline(cin, address);
}
int main() {
// Create an object of the class Student
Student student1;
return 0;
}
OUTPUT