帮助:在turbo C中预订电影 [英] HELP: a movie reservation in turbo C

查看:123
本文介绍了帮助:在turbo C中预订电影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将创建电影座位预订的程序。该程序将显示摘要席位及其状态。用户会问什么座位没有。要保留,然后它将再次返回摘要以显示更新的座位状态。如果座位没有。已经保留,然后它将提示错误消息。而且,如果输入座位no超出范围,那么它也会提示错误消息。该计划持续运行。该计划的终止将取决于程序员将如何申请。



我尝试过:



我尝试过使用数组。和Do-While语句,但我的程序以无限循环结束

A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply.

What I have tried:

I have tried using arrays. and Do-While statement but my programs ends in a infinite loop

推荐答案

我有一个算法,但我不能把它放入代码中。



嗯,然后拿一些纸和一支笔并手动跟踪你的算法。

这篇论文是你的变量需要,而你就是代码 - 所以写下你必须要做的每一步,让它自己工作。

那么你应该明白什么是数组和循环你要去需要,所以你可以开始实施它们。从小处开始,逐步测试每一位。

所以编写代码来设置所有内容,并使用调试器测试它的工作原理。

然后编写代码打印出当前的预订,并确保它有效。

然后开始编写其他功能,并在你去的时候测试每一个。



这是你的作业,而不是我们的作业 - 你不会学习如何在更复杂的任务上做到这一点,除非你学习如何在这样的相对琐碎的事情上做到这一点!所以坐下来,想想你在做什么,然后开始。
"I have an algo in mind but I can't put it into code."

Well, then get some paper and a pen and follow your algorithm manually.
The paper is the variables you need, and you are the code - so write down each step of what you have to do to make it work yourself.
Then it should be obvious what "arrays" and "loops" you are going to need, so you can start implementing them. Start small, and test each bit as you go on.
So write the code to set everything up, and use the debugger to test it works.
Then write code to print out the current reservations, and make sure it works.
Then start writing the other functions, and test each as you go.

This is your homework, not ours - and you won't learn how to do this on more complex tasks unless you learn how to do this on relatively trivial ones like this! So sit down, think about what you are doing, and make a start.


这篇关于帮助:在turbo C中预订电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆