Search This Blog

Friday 3 June 2016

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

How do I crack the GSOC in the field of machine learning?

How do I crack the GSOC in the field of machine learning? Working as a student at Google Summer of Code demands for your dedication an...