The data be\'ow can naturally be arranged in a 1-by-8 (or 8-by-1) struct array,
ID: 3564325 • Letter: T
Question
The data be'ow can naturally be arranged in a 1-by-8 (or 8-by-1) struct array, with 4 fields (fieldnames are Xaae. SID, MidtorxScoroa and FinallExam) (Hand-graded 16 points) For later calculations, note that all midterms and final are out of 100. Create the structure array Info containing all of the data. You may use any technique, but should use no more than 0 lines(3 pants) Modify lafo tang one Wie of code adding an errant Sth midterm scere of 81 to Erin's entry. Run the function CbeckFioldCoasiateacy on Info, checking consistency on the KidtorzScoros field. The function should detect the inconsistency Functions Slimaicl) and strveat may bo used here(2 points)Explanation / Answer
#include<stdio.h>
main ( )
{
struct
{
char name[ 20 ];
int class;
int marks;
} *rec[ 10 ];
int i;
for ( i = 0;i < 10;i++ )
{
printf ( "Name:" );
scanf ( " %s", rec[ i ] ->name );
printf ( "Class:" );
scanf ( " %d", &rec[ i ] ->class );
printf ( " Marks:" );
scanf ( " %d", &rec[ i ] ->marks );
}
printf ( "Name Class Marks " );
for ( i = 0 ; i < 10 ;i++ )
{
printf ( " %s " , rec[ i ] ->name );
printf ( " %d " , rec[ i ] ->class );
printf ( " %d " , rec[ i ] ->marks );
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.