Student Struct Example in C C++ Code Program Online
#include<stdio.h>
#include<conio.h>
struct student_record
{
char roll_no[10];
char name[15];
char sex_code;
int age;
float height;
}std[15];
void main(void)
{
int i;
for(i=0;i<15;i++)
{
printf("Enter the rollno\n");
gets(std[i].roll_no);
printf("Enter name\n");
gets(std[i].name);
printf("Enter sexcode\n");
scanf("%c",&std[i].sex_code);
printf("Enter height\n");
scanf("%f",&std[i].height);
}
getche();
}
#include<stdio.h>
#include<conio.h>
struct student_record
{
char roll_no[10];
char name[15];
char sex_code;
int age;
float height;
}std[15];
void main(void)
{
int i;
for(i=0;i<15;i++)
{
printf("Enter the rollno\n");
gets(std[i].roll_no);
printf("Enter name\n");
gets(std[i].name);
printf("Enter sexcode\n");
scanf("%c",&std[i].sex_code);
printf("Enter height\n");
scanf("%f",&std[i].height);
}
getche();
}
0 comments:
Post a Comment