Showing posts with label Program to store students record using structure. Show all posts
Showing posts with label Program to store students record using structure. Show all posts

Wednesday, July 20, 2011

Program to store students record using structure

/*Serial No.74     [swami51.cpp]*/

#include<stdio.h>
#include<conio.h>
struct student{
    int role_no;
    char name[20];
    int marks;
    char course[20];
    };
struct student stud[10];
void main()
{
int i;
clrscr();
printf("enter the students record one by one.\n");
for(i=0;i<3;i++)
    {
    printf("Enter the role no= ");
    scanf("%d",&stud[i].role_no);
    printf("Enter the name of student: ");
    scanf("%s",&stud[i].name);
    printf("Enter the marks obtained= ");
    scanf("%d",&stud[i].marks);
    printf("Enter the course: ");
    scanf("%s",&stud[i].course);

    }
    clrscr();
printf("---------STUDENTS RECORD FILE-------\n");
for(i=0;i<3;i++)
    {
    printf("\nROLE NO.: %d",stud[i].role_no);
    printf("\nNAME: %s",stud[i].name);
    printf("\nCOURSE: %s",stud[i].course);
    printf("\nMARKS OBTAINED: %d",stud[i].marks);
    printf("\n----------------------------------\n\n");
    }
getch();
}