Message from C, C++ discussions

November 2019

— Its when it collects that data and passes it to the next function where the program gets weird

— 

Choose_Array_Member_Amount function , which is what called the intial question function in the first place now has the data it needed from the initial question function and stores it in a variable called Choice

— Choice is passed it a switch statement

— God I lost it

— Because choice is an enumeration , a default case is not needed

— 

ArrayData choose_Array_Member_Amount(InitialQuestionP Choose){

int ArrayMemberTotal;
StringorInt choice = Choose();
ArrayData Array_Data;
Array_Data.chooseStringorInt = choice;

clearScreen();
switch(choice){

case INTEGAR:
puts("How many members do you need in your Integer Array?\n");
break;

case aSTRING:
puts("How many members do you need in your String Array?\n");
break;

}


if(scanf(" %d", &ArrayMemberTotal)){
Array_Data.ArrayMemberTotal = ArrayMemberTotal;
return Array_Data;
}

else if(scanf(" %d", &ArrayMemberTotal) != 1){
not_An_Number();
switch(choice){

case INTEGAR:
puts("How many members do you need in your Integer Array?\n");
break;

case aSTRING:
puts("How many members do you need in your String Array?\n");
break;
}
scanf(" %d", &ArrayMemberTotal);

}


}

Message permanent page

— This is the function where the issues happens

— If the user types in the create data type it works fine

— Choice is an enumeration called stringorInt that has two symbols, INTEGAR, or aSTRING, which we know at this point

Message permanent page

— Depending on which case it will ask the user one of two question

— But the same premise , how many members do you want in your array

— If i input an int it works fine,