228k views
12 votes
Design and implement a structured program for manipulating arrays data structures, as follow:

1- Use two dimensional string array data structure of five rows and six columns to store the data of five students, each student is identified by (stid, fname, and four final marks).
2- Then, split the above array into two other two dimensional arrays:
a- One for the (stid, and the fname) for the five students.
b- The other for (stid and the four final marks).
c- Show the contents of the new array (stid and the four final marks).
d- Prepare test data and implement it (run).

Design and implement a structured program for manipulating arrays data structures-example-1

1 Answer

11 votes

#include <stdio.h>

struct student {

char firstName[50];

int roll;

float marks;

} s[5];

int main() {

int i;

printf("Enter information of students:\\");

// storing information

for (i = 0; i < 5; ++i) {

s[i].roll = i + 1;

printf("\\For roll number%d,\\", s[i].roll);

printf("Enter first name: ");

scanf("%s", s[i].firstName);

printf("Enter marks: ");

scanf("%f", &s[i].marks);

}

printf("Displaying Information:\\\\");

// displaying information

for (i = 0; i < 5; ++i) {

printf("\\Roll number: %d\\", i + 1);

printf("First name: ");

puts(s[i].firstName);

printf("Marks: %.1f", s[i].marks);

printf("\\");

}

return 0;

}

#◌⑅⃝●♡⋆♡Nåmřāthā ♡⋆♡●⑅◌

User MarcinKonowalczyk
by
6.6k points