Uploaded by kimliksiz kral

Live Lecture Examples (2)

advertisement
Example 1:
Write a C program that includes the following operations:
a. In your program define a global data structure with name student as follows: The members
of the structure will be name, surname and grade.
b. Define 2 variables of type student structure and initialize
c. Display the name of the student that gets the max grade.
Example 2:
Write a C program that includes the following operations:
a. In your program define a global data structure with name student as follows: The members
of the structure will be name, surname and grade.
b. Create an array of 5 student in your main function.
c. Create a function called add_student() – This function takes the array of student structure
defined and asks the user to enter the details of studentsand adds these students to the
array.
d. Create a function called average() – This function will take the array and finds and prints
the average grade.
Example 3:
Write a C program that includes the following operations:
a. In your program define a global data structure with name student as follows: The
members of the structure will be name, surname ,midterm grade and final grade.
b. Define a variable of type struct student and initialize it with the following: Ayse Can 50
100
c. Create a function called average_grade() – This function takes the variable and
computes average grade of the student. Here is the function prototyoe: float
average(struct Student *pt)
Download