Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Adequate facilities for defining data types and structures aids readability. E.g

ID: 3870430 • Letter: A

Question

Adequate facilities for defining data types and structures aids readability. E.g. Early FORTRAN had no record/struct construct, so the "fields" of an "object" could not be encapsulated within a single structure (that could be referred to by one name). Later this semester, we will look at various categories of data types and look at design issues and design choices of common languages.. Records are among the simplest, most basic data structures.

1.Write a small program in a C-based language that uses an array of structs that store student information, including name, age, GPA as a float, and grade level as a string (e.g., “freshmen,” etc.).

2. Write the same program in the same language without using structs.

Answer only question #2

Explanation / Answer

1)

#include <stdio.h>
struct student
{
char name[50];
int age,roll;
float GPA;
char gradelevel[50];
} s[3];

int main()
{
int i;

printf("Enter students information: ");
for(i=0; i<3; ++i)
{
s[i].roll = i+1;

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

printf("Enter name: ");
scanf("%s",s[i].name);

printf("Enter age: ");
scanf("%d",&s[i].age);

printf("Enter GPA: ");
scanf("%f",&s[i].GPA);
  
printf("Enter gradelevel: ");
scanf("%s",s[i].gradelevel);

printf(" ");
}

printf("Displaying Information: ");
for(i=0; i<3; ++i)
{
printf(" Roll number: %d ",i+1);
printf("Name: ");
puts(s[i].name);
printf("age: %d",s[i].age);
printf("GPA: %.1f",s[i].GPA);
printf("gradelevel: ");
puts(s[i].gradelevel);
  
printf(" ");
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote