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

1. Open the input file and read the records into an array of Student structures.

ID: 654182 • Letter: 1

Question

1. Open the input file and read the records into an array of Student structures. You'll need to create this array dynamically, because you won't know how many records there are until you start reading the file itself. The data from each record in the file should be stored in one Student structure (i.e. one array slot per student record)

Here's my code:

studt*ptr;
ptr = new studt[n];
ipf >> new studt[n];

this is not compiling - the error message I'm getting is:

"error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'studt *' (or there is no acceptable conversion)"

Explanation / Answer

#include<stdio.h>

struct st{
int a;
char ch;
};

int main(void)
{
struct stud;
struct stud *ptr= &obj;

stud->a = 5;
stud->ch = 'a';

printf(" [%d] [%c] ", stud->a, stud->ch);
return 0;
}