WAP to create two different files name like roll and name of at least 5 students and print all on screen.
#include<iostream>
using namespace std;
class Student{
public:
char n[50];
int Roll;
float marks;
void getDetails(){
for(int i=1;i<5;i++){
cout<<"Enter information:\n";
cout<<"Enter name: ";
cin>>n;
cout<<"Enter roll number: ";
cin>>Roll;
cout<<"Enter marks: ";
cin>>marks;
}
}
void Display(){
for(int i=1;i<5;i++){
cout<<"Displaying Information:\n";
cout<<"Name: "<<n<<endl;
cout<<"Roll number: "<< Roll<<endl;
cout<<"Marks: "<<marks<<endl;
}}
};
int main(){
Student s;
s.getDetails();
s.Display();
}
Comments
Leave a comment