Code Competitions

Coding competition

Thursday, 30 May 2013

program to display student record

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
struct stud
{
    int rn;
    char name[20],fname[20];
    int mark;
};
void main()
{
    struct stud *s;
    int i,j,n;
    clrscr();
    cout<<"\nEnter the number of students ";
    cin>>n;
    s=new stud[n];
    for(i=0;i<n;i++)
    {
    cout<<"\nEnter the roll number ";
    cin>>(s+i)->rn;
    cout<<"\nEnter name of student ";
    gets((s+i)->name);
    cout<<"\nEnter father name of student";
    gets((s+i)->fname);
    cout<<"\nEnter marks ";
    cin>>(s+i)->mark;
    }
    for(i=0;i<n;i++)
    {
    cout<<"\nthe roll number "<<(s+i)->rn;
    cout<<"\nEnter name of student "<<(s+i)->name;
    cout<<"\nEnter father name of student "<<(s+i)->fname;
    cout<<"\nEnter marks "<<(s+i)->mark;
    }
    delete s;
    getch();
}




































































































No comments:

Post a Comment