Below is the text file 532 43 1 6.0 p R P E FE 110 TGE 20.00 290 88 3 11.30 a W
ID: 3613799 • Letter: B
Question
Below is the text file532 43 1 6.0 p R P E FE 110 TGE 20.00
290 88 3 11.30 a W V A SE 212A PPOG 5.0
530 32 2 11.30 a T F G AQQ 112C BETW 40.00
630 50 2 12.0 p M A M DE 220 GHE 10.00
610 55 3 4.0 p R V N PJE 105 RTQ 5.00
Please below is the multi dimensional array I'm trying to input andstore the file data above to, but I'm not sure if my arraydeclaration is okay.
#include<stdio.h>
int main (void)
{
intgroupnum[20][20];
intmeetweek[20][20];
intgroupsize[20][20];
charmeethalfday[20][20];
charmeetingday[20][20];
charpurpose[20][20];
charmembtype[20][20];
charmeetbuilt[20][20]; //string
charmeetroom[20][20]; //character
chargroupname[20][20]; //string
floatmeettime[20][20];
floatgroupcost[20][20];
FILE*input;
int i, j,index;
}
Each array will have 20 elements in it for amaximum of twenty activities
Please I'm really confuse about how to store thetext file above to the mult-dimensional arrays.
integer multi-dimensional array
Column [0] Group/activitynumber
Column [1] Meeting week
Column [2] Group/activitysize
character multi-dimensional array
Column [0] Meeting half day
Column [1] Meeting day
Column [2] Group/activitypurpose
Column [3] Group/activity membertype
Columns [4 through 7] Meetingbuilding
Columns [8 through 12] Meetingroom
Columns [13 through 39] Groupname
float point multi-dimensional array
Column [0] Meeting time
Column [1] Group/activitycost
Explanation / Answer
Please rate - thanks The problem is you can't use a multi dimension array. In a multi dimension array all the data must be of the same type,you have different types of data #include #include int main() {int iarr[20][3],i,j,k; char carr[20][40]; float farr[20][2]; FILE *f; f = fopen("input.txt","r"); if(f == NULL) {printf("Error opening File! "); return 0; } i=0; while(fscanf(f,"%d",&iarr[i][0])!=EOF) //get group # { printf("Here%d ",iarr[i][0]); for(j=1;jRelated 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.