This is very frustrating code. This is very long code and I havebeen spending al
ID: 3613427 • Letter: T
Question
This is very frustrating code. This is very long code and I havebeen spending all day to figure out where the problem is, soI just able to find out so please help me on array ofcharacters.#include<stdio.h>
#define MAXGROUP 3
void mm(char st[], int func);
int main(void)
{
char meetday[MAXGROUP];
char ch;
int count;
int index;
printf("Please enter a number ");
scanf("%d", &count);
printf(" Below are the a.m or p.m info for the meeting time of theassociated group or activity ");
printf(" ----------------------------------------------------------------------------- ");
printf(" Enter 'p' for first group meeting time p.m ");
printf(" Enter 'p' for second group meeting time p.m ");
printf(" Enter 'p' for third group meeting time p.m ");
for(index=1;index<=count;index++)
{
scanf("%c", &meetday[index]);
while ((ch = getchar()) != ' ' );
}
mm(meetday, count);
return 0;
}
void mm(char st[], int func)
{
int index;
for(index=1;index<=func;index++)
printf("The value is%c ", st[index]);
}
EVERYTIME I EXECUTE IT, IT DOESN'T PRINT THE FIRST P BUT
IT WORKS FIND WHEN I ASSIGN CONSTANT TO THE "COUNT" VARIABLE, BUT IDON'T WANT IT LIKE THAT, I WANT THE USER TO DETERMINE THE MEETINGTIME. THANKS
Explanation / Answer
//Hope this will help you, don't forget torate it. //Dear, Index start from 0, not 1. #include #define MAXGROUP 3 void mm(char st[], int func); int main(void) { char meetday[MAXGROUP]; char ch; int count; int index; printf("Please enter a number "); scanf("%d", &count); printf(" Below are the a.m or p.m info for the meeting time of theassociated group or activity "); printf(" ----------------------------------------------------------------------------- "); printf(" Enter 'p' for first group meeting time p.m "); printf(" Enter 'p' for second group meeting time p.m "); printf(" Enter 'p' for third group meeting time p.m "); for(index=0;indexRelated 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.