Message from C, C++ discussions

November 2019

— 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);

}


}

— 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,

— But if type in lets say a letter , its called the not_an_option() function which is not even lexically even in that function

Message permanent page

— That function is only called in the initial question function

— You write so much

— Lol