Subscribe Us

Responsive Advertisement

Advertisement

Storing students information

 

Storing students information



#include<bits/stdc++.h>

#include<fstream>

using namespace std;

int main()

{


    ofstream out;

    out.open("outpout.txt");

   for(int i=1;i<=3;i++)

   {

       //cin.ignore();


        string name,dept;

    int id;

    cout<<"Enter your name :\n";

    char c;

    cin>>c;

    getline(cin,name);

    name=c+name;

    out<<name<<"   ";

    cout<<"Enter your dept : ";

    getline(cin,dept);

    out<<dept<<"   ";



    cout<<"Enter your id : ";

    cin>>id;

    out<<id<<endl;

   }

   out.close();

    return 0;

}


Post a Comment

0 Comments