I have an object struct named Course. I also have an array Course array[CAPACITY], where capacity = 100 and the size is 0. I do not know how to place the four attributes of object Course into an array and I was hoping to get an answer. I am using a for loop that takes in the class name, year, grade, and units, so how can I put that all into a Course object and then into an array of Course objects?
so once your read all the data than create and object for
the structure and plcae it
for(int i=0;i<100;i++){
cin>>name;
cin>>year;
cin>>grade;
cin>>units;
//creating structure object
Course c;
//assigning data to the structure object
c.name=name;
c.year=year;
c.grade=grade;
c.units=units;
//putting that object into array
array[i]=c;
}
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME
Get Answers For Free
Most questions answered within 1 hours.