Oops File
Oops File
Objective: Write a program that uses a class where member functions are defined inside the
class.
Program:
#include<iostream>
#include<math.h>
using namespace std;
class studentInfo{
// Member variables
string rollNo;
string name;
float marks;
public:
//Member Functions
void getInfo(studentInfo st[], int size){
for(int i=0; i<size; i++){
cout<<"Enter roll no: ";
cin>>st[i].rollNo;
cin.ignore();
cout<<"Enter name: ";
getline(cin, st[i].name);
cout<<"Enter marks obtained: ";
cin>>st[i].marks;
cin.ignore();
cout<<endl;
}
}