x.Hm need help changing the struct member \"char nextmeet[6]\" to two digit inte
ID: 3614829 • Letter: X
Question
x.Hm need help changing the struct member "char nextmeet[6]" to two digit integerfor next month and two digit integer for next day, like "int nextmonth; and int nextday;" but the data file has a forward slash between them (column 7 from left " / ") which it can not remove, so I can't figure out how it works, so please can somebody help me? thank you.
133 41 3 1.0 p R 10/12 P U TRH 440 5.00 Society of Hispanic Professional Engineers
135 90 4 9.0 a S 11/9 C 1 AVE 228 4.00 Society of Professional Engineers
140 36 2 12.0 p M 10/10 L B TTD 110 5.00 Association for Computing Machinery
141 45 3 2.30 p R 10/11 V 1 MOC 316 3.00 Game Developer's Club
134 18 4 1.0 p R 10/9 M W SOC 105 5.00 National Society of Black Engineers
488 20 1 12.0 p F 10/10 P M AGT 100 20.00 Student Senate
525 15 2 11.30 a T 10/11 O 3 BOD 218 5.00 Marching band
491 100 3 3.0 p N 10/9 V A SH 121 0.0 AWT Volunteers
512 15 1 9.30 a S 10/12 C L LAM 118A 15.00 Concert choir
170 91 4 10.0 a M 10/11 F R RSV 402P 6.00 Biomedical Engineering Student Society
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAXGROUP 9
#define MINCOUNT 4
#define MAXCOUNT 9
#define ZERO 0
struct activities
{
int groupnum;
char *groupname;
float meettime;
char mthalfday;
char meetday;
int meetweek;
char nextdate[6]; /*THIS NEEDS TO BE CHANGE TO 2 DIGIT NUMBER FOR NEXT MEETING MONTH AND ANOTHER 2 DIGIT NUMBER FOR NEXT MEETING DAY*/
char buildingloc[4];
char meetroom[5];
char purpose;
char memtype;
int groupsize;
float groupcost;
};
void printallinput(struct activities fungroup[MAXGROUP], int xindex);
int main(void)
{
FILE *groupfile;
struct activities group[MAXGROUP];
int iindex, jindex, kindex, count;
int intro, index, len;
int choose, xindex, xcount;
char chflush;
char temparr[100];
printf(" Activities which you are interested in must be between 12 and 20. ");
printf("Please enter your choice:>>> ");
scanf("%d", &count);
while((count < MINCOUNT) || (count > MAXGROUP))
{
printf(" Wrong input: Please reenter the number of activities you interested in ");
printf(" Must be between %d and %d ", MINCOUNT, MAXCOUNT);
scanf("%d", &count);
}
groupfile = fopen("file.dat", "r");
if(groupfile == NULL)
{
printf(" Error opening File! ");
return 0;
}
iindex = 0;
while(iindex<count && fscanf(groupfile,"%d", &(group[iindex].groupnum)) != EOF)
{
fscanf(groupfile, "%d", &(group[iindex].groupsize));
fscanf(groupfile, "%d", &(group[iindex].meetweek));
fscanf(groupfile, "%f", &(group[iindex].meettime));
fgetc(groupfile);
group[iindex].mthalfday = fgetc(groupfile);
fgetc(groupfile);
group[iindex].meetday = fgetc(groupfile);
fgetc(groupfile);
for(jindex=0;jindex<6;jindex++)
{
group[iindex].nextdate[jindex] = fgetc(groupfile);
if(group[iindex].nextdate[jindex] == ' ')
&
Explanation / Answer
x.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.