x Turn on thread page Beta
 You are Here: Home

# turbo pascal watch

1. hello, i am currently making a pizza program using turbo pascal.
i need help with using an array so that I can calculate what the user has ordered from it and then give them a total of what they have ordered. can anyone help me with this?
2. (Original post by cooldude17)
hello, i am currently making a pizza program using turbo pascal.
i need help with using an array so that I can calculate what the user has ordered from it and then give them a total of what they have ordered. can anyone help me with this?
I can only remember something like this from java, though i'm rusty, so it should provide some helpful tips
Usually make an array, with the prices of each product.............. and whatever is ordered, make sure when you ask them, the points on the order array corresponds with the array for the prices in the first array and then use a loop to work it out.
Large pizza, large garlic bread, chicken wings, bottle of coke, extra
e.g {12.50, 6, 5, 2, 4}

How many large pizzas do you want?
2
""
0
""
1
""
2
""
0

So the order array is {2, 0, 1, 2, 0}
So corresponds {12.50, 6, 5, 2, 4}

loop it.......

for(int = i, i= 0, i++)
{
............... whatever
}
3. (Original post by Iqbal007)
I can only remember something like this from java, though i'm rusty, so it should provide some helpful tips
Usually make an array, with the prices of each product.............. and whatever is ordered, make sure when you ask them, the points on the order array corresponds with the array for the prices in the first array and then use a loop to work it out.
Large pizza, large garlic bread, chicken wings, bottle of coke, extra
e.g {12.50, 6, 5, 2, 4}

How many large pizzas do you want?
2
""
0
""
1
""
2
""
0

So the order array is {2, 0, 1, 2, 0}
So corresponds {12.50, 6, 5, 2, 4}

loop it.......

for(int = i, i= 0, i++)
{
............... whatever
}
sorry but now it just sounds confusing, should i show the coding for my program?

An array may not be the best thing to use: what happens when someone orders a thousand pizzas for a big party?
5. (Original post by cooldude17)
sorry but now it just sounds confusing, should i show the coding for my program?
yeah possibly.

What i'm saying is that you make 2 arrays.......... where one holds the prices of the specific items.........the other the order which corresponds to the prices. So in array 0 it holds the price for the basic pizza, so when you ask how many basic pizzas they want, the value given should go into array 0 in the other array.
6. As a rule, you shouldn't use Reals for money - have an integral number of pennies instead, doing the conversion into pounds and pence when you display the results.

It has been a while since I used Turbo Pascal - what happens if someone enters say, 'A', when you're expecting a number?

The main loop costs 'show them the options, did they ask for a table or help> If so, do that (although there doesn't seem to be a test to see if they did do the table bit before taking the order) otherwise, assume they're trying to order pizza.' Again, if they enter anything other than '1' or '3', it may not have been '2'!

At no point to do you record what they've ordered or use that array...
7. (Original post by unprinted)
As a rule, you shouldn't use Reals for money - have an integral number of pennies instead, doing the conversion into pounds and pence when you display the results.

It has been a while since I used Turbo Pascal - what happens if someone enters say, 'A', when you're expecting a number?

The main loop costs 'show them the options, did they ask for a table or help> If so, do that (although there doesn't seem to be a test to see if they did do the table bit before taking the order) otherwise, assume they're trying to order pizza.' Again, if they enter anything other than '1' or '3', it may not have been '2'!

At no point to do you record what they've ordered or use that array...
im just doing what the assingment tells me to do, i have to use those prices
8. I have millions of problems with my program at the moment and I could really use big help this, would really appreciate this
9. At the moment, it looks like you've spent lots of time on getting the menus looking pretty and not nearly enough on getting the structure and algorithm right.

Procedure ShowOptions ;
Begin
WriteLn ('Show Options') ;
End ;

etc and get the actual program working. Then go back and make it pretty.

Much more help would mean us writing the assignment for you, without the benefit of seeing the spec.
10. (Original post by unprinted)
At the moment, it looks like you've spent lots of time on getting the menus looking pretty and not nearly enough on getting the structure and algorithm right.

Procedure ShowOptions ;
Begin
WriteLn ('Show Options') ;
End ;

etc and get the actual program working. Then go back and make it pretty.

Much more help would mean us writing the assignment for you, without the benefit of seeing the spec.
shall i upload the program itself then, if so should I send you it via msn

My other reminder is that in Pascal, you can have a 'pizza' type, and things like "array [pizza] of cost".
12. (Original post by unprinted)

My other reminder is that in Pascal, you can have a 'pizza' type, and things like "array [pizza] of cost".
I meant the actual tp file so that you can run it and edit it
13. (Original post by cooldude17)
I meant the actual tp file so that you can run it and edit it
Mmm, yes, but why would I want to do that? It's your assignment.

General advice, yes. Doing it for you, I'm afraid not.
14. Why TP, may I ask?
Python seems easier (and it's more wisely used in real-life applications)
15. (Original post by simon_g)
Python seems easier (and it's more wisely used in real-life applications)
because thats how the assinement goes
16. (Original post by unprinted)
Mmm, yes, but why would I want to do that? It's your assignment.

General advice, yes. Doing it for you, I'm afraid not.
please man, i have no experience in using tp and i really need help with it. the work is basically done but it has a lot of bugs and i need to add the arrays to it

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: April 21, 2013
Today on TSR

### Four things top students are doing

Over the Easter break

Poll
Useful resources