Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- #define SIZE 5
- typedef char string10[11];
- struct bdaystruct{
- int year;
- int month;
- int day;
- };
- typedef struct {
- string10 name;
- int id;
- float gpa;
- struct bdaystruct bday;
- }studentBlock;
- void inputinfo(studentBlock* student, studentBlock* students){
- int i;
- for (i = 0 ; i < SIZE ; i++)
- {
- student->bday.day=i;
- student->bday.month=i;
- student->bday.year=i;
- student->gpa=i;
- student->id=i;
- students[i] = *student;
- }
- }
- void displayinfo(studentBlock* students){
- int i;
- for(i = 0 ; i < SIZE ; i++){
- printf("Id no. [%d]: %d\n", i + 1, students[i].id);
- printf("GPA [%d]: %.2lf\n", i + 1, students[i].gpa);
- printf("Birthday [%d], %d / %d / %d\n", i + 1, students[i].bday.month,students[i].bday.day,students[i].bday.year);
- printf("\n");
- }
- //printf("Name [%d]: %s\n",1 , student[0]->name);
- }
- int main(){
- studentBlock student, students[SIZE];
- inputinfo(&student, students);
- displayinfo(students);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement