Hi. I need some help with some code i'm writing. I'm new to c++ and to be honest i feel like i have tried everything but cant get this bit working. I've included the small part of the program i have so far. I still have a lot to do but am stuck on this part. The user picks a choice of train station then picks another train station from the same list. I have succesfully set it up so a choice can be made and then the next choice but when i try to show the two choices in the line //Show summary of chosen station, i cannot get it to show the station names, only some symbols. I some how need to address the station names so they can be accessed throughout the program and i have tried lots of thingsbut cant get it working. If anyone can help it would be much appreciated.
int main(int argc, char *argv[])
{
int leaving, arriving, choice1, choice2;
char stationsswitch(int);
printf("\nEnter the station you will be leaving from by \nentering the corresponding number from the list below");
printf("\n 1 = Ashford\n 2 = Brentworth\n 3 = Canonbury Cross\n 4 = Dowgate\n 5 = Edbury\n");
printf(" 6 = Fenchurch Street\n 7 = Gresham\n 8 = Hampstead\n 9 = Islington\n 10 = Jamaica Road\n");
scanf ("%d", &leaving); //Put number in leaving
choice1 = stationsswitch(leaving); //Use function to pick station using leaving choice number
printf(" as your leaving station\n"); //show chosen station
printf("\nEnter the station you will be arriving at by \nentering the corresponding number from the list below");
printf("\n 1 = Ashford\n 2 = Brentworth\n 3 = Canonbury Cross\n 4 = Dowgate\n 5 = Edbury\n");
printf(" 6 = Fenchurch Street\n 7 = Gresham\n 8 = Hampstead\n 9 = Islington\n 10 = Jamaica Road\n");
scanf("%d", &arriving); //Put number in arriving
choice2 = stationsswitch(arriving); //Use function to pick station using arriving choice number
printf(" as your arriving station.\n\n"); //show chosen station
printf("You have selected %c and %c as your stations\n\n", choice1, choice2); //Show summary of chosen stations
system("PAUSE");
return 0;
}
char stationsswitch(int choice1) //Function for deciding station choice
{
switch (choice1)
{
case 1:
system ("CLS");
printf("You have selected Ashford ");
break;
case 2:
system ("CLS");
printf("You have selected Canonbury Cross ");
break;
case 3:
system ("CLS");
printf("\nYou have selected Canonbury Cross ");
break;
case 4:
system ("CLS");
printf("\nYou have selected Dowgate ");
break;
case 5:
system ("CLS");
printf("\nYou have selected Edbury ");
break;
case 6:
system ("CLS");
printf("\nYou have selected Fenchurch Street ");
break;
case 7:
system ("CLS");
printf("\nYou have selected Gresham ");
break;
case 8:
system ("CLS");
printf("\nYou have selected Hampstead ");
break;
case 9:
system ("CLS");
printf("\nYou have selected Islington ");
break;
case 10:
system ("CLS");
printf("\nYou have selected Jamaica Road ");
break;
}
}