I need help with completing and some codes together
Key aims: 1. The user can select a departure station
2. The user can select an arrival station
3. the user can select either single or return journey.
i need the code to be able to show the result of the arrival and departure station and a way to count the stops so i could add to the calculation.
Code:
#include <stdio.h>
void station1()
{
printf( "Ashford Station" );
}
void station2()
{
printf( "Brentworth Station" );
}
void station3()
{
printf( "Canonbury Cross Station" );
}
void station4()
{
printf("Dowgate Station");
}
void station5()
{
printf("Edbury Station");
}
void station6()
{
printf("Fenchurch Street Station");
}
void station7()
{
printf("Gresham Station");
}
void station8()
{
printf("Hampstead Station");
}
void station9()
{
printf("Islington Station");
}
void station10()
{
printf("Jamaica Road Station");
}
int main()
{
int input;
printf( "1. Ashford Station\n" );
printf( "2. Brentworth Station\n" );
printf( "3. Canonbury Cross Station\n" );
printf( "4. Dowgate Station\n");
printf( "5. Edbury Station\n");
printf( "6. Fenchurch Street Station\n");
printf( "7. Gresham Station\n");
printf( "8. Hampstead Station\n");
printf( "9. Islington Station\n");
printf( "10. Jamaica Road Station\n");
printf( "11. Exit\n" );
printf( "Arrival Station:" );
scanf( "%d", &input );
printf("Depature Station:");
scanf("%d",&input);
switch ( input ) {
case 1:
station1();
break;
case 2:
station2();
break;
case 3:
station3();
break;
case 4:
station4();
break;
case 5:
station5();
break;
case 6:
station6();
break;
case 7:
station7();
break;
case 8:
station8();
break;
case 9:
station9();
break;
case 10:
station10();
break;
case 11:
printf( "Thanks\n" );
break;
default:
printf( "Invaild input, quitting!\n" );
break;
}
getchar();
}
I have a price code which i can't complete
Code:
#include<stdio.h>
int main(void)
{float ticketcost=2.00f, returncost=0.0f, stops =0.0f, singlecost=0.0f, priceofjourney =0.0f;
{int choice;
printf("\nEnter Either 1 for Single Journey or 2 for Return Journey:");
scanf("%d", &choice);
if (choice==1)
{
printf("\nSingle Journey:");
scanf("%f", &singlecost);
}
else if (choice==2)
{
printf("\nReturn Journey:");
scanf("%f", &returncost);
}
else
{
printf("\nInvalid Option");
}
{float ticketcost=2.00f, returncost=0.0f, stops =0.0f, singlecost=0.0f, priceofjourney =0.0f;
singlecost=ticketcost*stops;
returncost=singlecost * (singlecost/2);
printf("\nPrice of single journey = %.2f\n\n", singlecost);
printf("\nprice of return journey = %.2f\n\n", returncost);
getchar();
return 0;}
}
}
I would really appreciate any advice or help.
thanks