Search This Blog

Click Banner To Join Our Whatsapp Group

Click Banner To Join Our Whatsapp Group
Click the banner to Join Now

Saturday 25 January 2020

WAP to get roll numbers and marks of the student of a class (get from the user) and store these details into a file called Marks.dat

/*WAP to get roll numbers and marks of the student of a class (get from the user) and store these details into a file called Marks.dat*/
#include<iostream.h>
#include<fstream.h>
int main()
{     ofstream filout;
      filout.open("marks.dat",ios::out);
      char ans = 'y';
      int rollno;
      float marks;
      while(ans =='y'||ans =='Y')
      {
            cout<<"\nEnter Roll no.: ";
            cin>>rollno;
            cout<<"\nEnter Marks : ";
            cin>>marks;
            filout<<rollno<<'\n'<<marks<<'\n';
            cout<<"\nWant to enter more records? (y/n)... ";
            cin>>ans;
      }
      filout.close();
      return 0;
}


OUTPUT


No comments:

Post a Comment