Help me to do assignment pls

I was given an assignment but I don't know much about c programming. please i will like to know more that's the reason I have decided to join this forum.

A new metro system is to be constructed by an independent company somewhere in the UK to link up 10 stations in a line (not a loop). The name of the station s are as follows:-
Ashford - Brentworth - Canonbury Cross - Dowgate - Edbury - Fenchurch Street - Gresham - Hampstead - Islington - Jamaica Road

The distance between each of the stations is fairly equal therefore the ticket cost between each station is £2.00 with an extra 50% added on for a return journey.

Example: A return ticket from brentworth to hampstead will cost £18.00

The company would like a user friendly piece of software to operate their ticket machines. All that is required at this stage is that the software does the following:-
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.

The program must then display on the screen a suitable summary of the ticket that the user can check prior to accepting and and paying.



please can anyone help me out with this?
no. i know nothing in c++ or c
closed account (48T7M4Gy)
@OP So far it appears that you might think this is a homework site. It isn't.

The best we can do is help you with problems you might be having with C++ and associated issues. Help given is often quite generous and could be misunderstood by some as doing homework for strangers. That isn't right either.

Given that you know nothing about C or C++, might we suggest you avail yourself of the excellent tutorials on this site. Of course, if you have problems with those on you learning curve journey, please don't hesitate to seek further help.

We hope you enjoy the tutorials and who knows, your OP problem may be solved by you under your own steam. Good luck with it :)

http://www.cplusplus.com/doc/
#include <stdio.h>


int main() {
char *stations[10]={"Ashford","Brentworth","Canonbury Cross","Dowgate","Edbury","Fenchurch Street","Gresham","Hampstead","Islington","Jamaica Road"};
int continueFlag=1;
int canDo =1;
char* dStation = malloc(sizeof(char));
char* aStation =malloc(sizeof(char));
int journey =1;
int price =0;
printf("********************************************************************************\n");
printf("*Usage:Input departure station name,arrival station name,single or return journey.\n");
printf("*Each station name is its first letter, 0 for single journey,1 for return journy. \n");
printf("*Example: A single ticket from Ashford to Edbury,the user can input ae0 or AE0 \n");
printf("*Press quit to close program \n");
printf("*Stations :{Ashford、Brentworth、Canonbury Cross、Dowgate、Edbury、 \n");
printf("* Fenchurch Street、Gresham、Hampstead、Islington、Jamaica Road} \n");
printf("******************************************************************************** \n");

while (continueFlag) {
fflush(stdin);
int retVal = scanf("%c%c%d",dStation,aStation,&journey);
if (retVal==3) {
if (isStationExist(*dStation)==0){
canDo=0;
printf("%c is not right station name \n",*dStation);
}
if (isStationExist(*aStation)==0) {
canDo=0;
printf("%c is not right station name \n",*aStation);
}
if (isTicketType(journey)==-1) {
canDo=0;
printf("%d is not right ticket type. 0 for single 1 for return\n",journey);
}
int startIndex = getStationIndex(dStation);
int endIndex = getStationIndex(aStation);
if(canDo) {
if (journey) {
price = abs(endIndex-startIndex)*returnPrice;
} else {
price = abs(endIndex-startIndex)*singlePrice;
}
char* tickType[2]={"single","return"};
printf("the %s price of station between %s and %s is ♀%d \n",*(tickType+journey),*(stations+startIndex),*(stations+endIndex),price);
} else {
printf("error input,please try again \n");
canDo=1;
}
}
else {
if (*dStation=='q') {
continueFlag=0;
} else {
printf("error input,please try again \n");
}
}
}
free(aStation);
free(dStation);
return 0;
}

what's wrong here?
closed account (48T7M4Gy)
what's wrong here?

4 problems:
1. No manners.
2. No code tags.
3. No description of problem - input expected vs what happened etc
4. No mind readers on duty today.

Beyond that, all good :)
closed account (48T7M4Gy)
Wow, what a traumatic expence it must be, you've been working on this problem for nearly 5-1/2 years. Poor you!


http://cboard.cprogramming.com/archive/index.php/t-136990.html
Topic archived. No new replies allowed.