#include
struct classdata{
char name[20],rollno[15];
int age,height;
};
void main()
{
int i=1,j;
char choice;
struct classdata db[30];
clrscr();
printf("\n-----Data Entry for Students -----");
do
{
printf("\n\n\t\tEnter the Student's name: ");
scanf("%s",db[i].name);
printf("\t\tEnter Roll Number: ");
scanf("%s",db[i].rollno);
printf("\t\tEnter age: ");
scanf("%d",&db[i].age);
printf("\t\tEnter height: ");
scanf("%d",&db[i].height);
printf("\n\tEntry for Mr. %s has been saved.",db[i].name);
printf("\nDo you want to enter data for someone else? (Press Y/y for Yes):");
scanf("%s",&choice);
i++;
}while(choice=='Y'||choice=='y');
printf("\n\n\t\t----------------------------------------------");
printf("\n\t\tName\t\tRoll No.\tAge\tHeight");
printf("\n\t\t----------------------------------------------\n");
for(j=1;j{
printf("\n\t\t%s",db[j].name);
printf("\t\t%s",db[j].rollno);
printf("\t%d Yrs",db[j].age);
printf("\t%d cms",db[j].height);
}
printf("\n\t\t----------------------------------------------");
getch();
}
No comments:
Post a Comment