Answer to Question #273814 in C++ for Amit

Question #273814

WAP to create two different files name like roll and name of at least 5 students and print all on screen.



1
Expert's answer
2021-11-30T18:39:24-0500
#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();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS