This is a discussion on Help pleasee within the C Programming forums, part of the General Programming Boards category; I am stuck on how to write statements in code.. 1) output a single line of the form: SOLD TICKETS ...

I am stuck on how to write statements in code..

1) output a single line of the form:

SOLD TICKETS a - b

//(I DO NOT HAVE THIS PART)
where a is the starting number of the tickets sold and b is the ending number (inclusive) of the tickets sold. If k is 1, then a and b will be equal. (Note: For the very first command of this type, the value of a will equal the number of presold tickets, since the presale tickets are numbered from 0 to the total number of presale tickets minus .

2)The two reasons to reject a bid are if the raise of the bid isn't more than the minimum required or if the auction has been closed already. For an initial bid, it must equal the minimum raise of the bid. Thus, we assume that without any bids, the first price of the item is \$0.

3) where k represents the number of the drink sold and n represents the drink number, ranging from 0 through 9, inclusive. Note that for this line of output, the value of k may differ from the number of drinks requested by the guest, if the inventory runs out. If the drink requested is already sold out, the latter message should be printed.

I just dont kow how to write these in code - c programm
ANY HELP WOULD BE APPRECIATED!!

2. Please make an attempt to write the code and post your results if you have any questions. This is not a free code writing service. If you know absolutely nothing about programming then start reading some tutorials online (you can start with the ones on this website for instance) and think about what you want the program to do step by step.

3. This is what i have..
Code:
if(strcmp(action2,"TICKET")==0)
{
fscanf(ifp, "%d",&k);
fprintf(ofp, "SOLD TICKETS A-B");
}
else if(strcmp(action2,"RAFFLE")==0)
{
fscanf(ifp, "%d", &p, &k);
fprintf(ofp, "raffle tickets a-b given to person %d");
fprintf(ofp, "No raffle tickets give to person %d";)
}
else
{
fscanf(ifp, "&d",&n,&k);
fprintf(ofp, "sold %d of drink %d");
fprintf(ofp, "No drink %d Sold");
}

}
else if (strcmp(action, "BID") == 0)
{
BIDITEM(ifp,ofp);
if(strcmp(action3,"ITEM")==0)
scanf("%d",&k, &p, &d);
printf("BIDITEM %d ACCEPTED FOR PERSON %d AT %d \$");
printf("BIDITEM %d REJECTED FOR PERSON %d AT %d \$");

}
else if (strcmp(action, "AWARD") == 0)
{
AWARD(ifp,ofp);
if(strcmp(action4,"RAFFLE")==0)
scanf("%d",&i, &t);
printf("raffle %d won by person %d");
if(strcmp(action4,"AUCTION")==0)
scanf("%d",&i);
printf("auction item %d won by person %d for \$")
if(strcmp(action4,"PERSON")==0)
scanf("%d",&i);

}

}

}

4. Weezy, welcome to the forum!

I can't understand WHAT you are trying to do here. Forget the assignment for a minute, and forget code - describe in English, what you are trying to program up, just plain English but a good description, please.

What do you have on hand (maybe in tickets or money or ??)?
What is the input to the program (bids)? When are they accepted and when are they rejected?

What calculations do you need the program to make?
What output do you need from the program?

Things like that.

5. 1) Ticket sales
2) Silent Auction
3) Raffle
4) Drink sales
it will log the number of tickets sold both in advance and at the event, a silent auction for donated items, a raffle for other donated items and the number of drinks sold.
SOLD TICKETS a - b
where a is the starting number of the tickets sold and b is the ending number (inclusive) of the tickets sold.. and than so forth for the others..

6. Your fscanfs/fprintfs are incomplete - Hopefully this puts you on the right track.
Code:
fscanf(ifp, "%d %d", &p, &k);
fprintf(ofp, "raffle tickets a-b given to person %d", p);
fprintf(ofp, "No raffle tickets give to person %d", k);