Tuesday, May 12, 2015

Array Program

ARRAY OF STRUCUTURE 
1.       Struct employee
{
Char name [20];
Int empid;
Float salary;
} emp [10];

2.       Struct employee
{
Char name [20];
Int empid;
Float salary;
};

Struct employee emp[10];


Write a program to created a structure name student that has name, roll no., marks & remarks as member, used this structure to read & display record of 5 std.

Struct student
{
Char name [50], remarks[10];
Int rollno;
Float marks;
};
Main()
{
Struct student std[5];
Int I;
For (i=0; i<5; i++)
{
Printf(“in enter %d student date”, i+1);
Printf(“name”);
Gets(std [i], name);
Printf(“rollno”);
Scanf(“%d”, &std[i]. rollno);
Printf(“remarks”);
Gets(std[i].remark);
Printf(“marks”);
Scanf(“%f”, &std [i]. mark);
}
Printf(“name\+ rollno\ + remarks\ + mark|n”);
For(i=0; i<5; i++)
Printf(“%s\t%d\t%s\t%f”, std[i].name, std[i].rollno, std[i].remarks, std[i].marks);
}
Getch();
}








No comments:

Post a Comment