Hello,
I'm pretty new to the C language and the TA isn't on my campus right now so i thought i would ask on the forums
here is my problem, I have to store a state in 2 separate arrays because my professor wont allow us to use stings for this exercise. The way i have my code set up now is it gets data about a specific event and at the end of the for loop it gets the state. How would i go about putting the inputted state into these two arrays ?
The array names are state1 and state2
If the user place TX for Texas in the input i need state1 to contain T, and state2 to contain X.
Please help if you can
Code:
for(i = 0; i < events; i++ )
{
printf("Please enter event code for event number %d:", i + 1);
scanf("%d", &code[i]);
printf("Please enter the month of the event number %d:", i + 1);
scanf("%d", &month[i]);
printf("Please enter the day of the event number %d:", i + 1);
scanf("%d", &day[i]);
printf("Please enter the year of the event number %d:", i + 1);
scanf("%d", &year[i]);
printf("Please enter the earlybird special cost for event number %d:", i + 1);
scanf("%f", &earlycost[i]);
printf("Please enter the regular cost for event number %d:", i + 1);
scanf("%f", ®cost[i]);
printf("Please enter speakers series letter for event number %d:", i + 1);
scanf("%c", &series[i]);
getchar();
printf("Please enter speakers state for event number %d:", i + 1);
scanf("%c%c", &state1[i], &state2[i]);
}