Tuesday, December 6, 2011

Write a C Program to Create a student Data Structure

#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
 char another='y';
 struct student
 {
  char name[40];
  int roll;
  float marks;
 };
 struct student e;
 clrscr();
 while(another=='y')
 {
  printf("\nEnter Name: ");
  scanf("%s",&e.name);
  printf("Enter Roll: ");
  scanf("%d",&e.roll);
  printf("Enter Marks: ");
  scanf("%f",&e.marks);
  printf("Add Another Record (y/n): ");
  fflush(stdin);
  another=getche();
 }
 getch();
}

No comments:

Post a Comment