- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
编译并运行后,选择“否”。 1和y,不会算价格吧?请帮忙。而且它也不让我选择座位。经过进一步检查,其余电影的价格甚至都不会加载。请帮忙
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void printarray(const int[6][10]);
float price();
float seat();
int i,j;
int array[50][50]={1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,
2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,
3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,
4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,
5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10,
6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10};
float padult=12.00, pkids=8.00, total, adult, kids, tadult, tkids;
char choice1, y, n;
char decision1;
char decision2;
int main()
{
printf("\n\t\t\t WELCOME \n\t\t\t\t\tTO\n\t\t\t THE CINEMAS \n");
printf("\n\t\t Please choose your movie: \n");
int choice;
printf("\n\t\t1. Finding Nemo ");
printf("\n\t\t2. Transformers ");
printf("\n\t\t3. Don't Break My Heart");
printf("\n\t\t4. Meet The Robinson");
printf("\n\t\t5. Good Night!!");
printf("\n\t\t6. Cancel");
printf(" \n\n\n Please choose 1 of the option: ");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("\nTitle: Finding Nemo\n");
printf("Description:\n");
printf("About a fish name Nemo caught by a human. And his father tries to save him by travelling around the world. ");
printf("\nNemo is being caught and unconciously being brought to Sydney, Australia..." );
printf("\nWill his father who never leave their home save Nemo... Will his father survive the travelling around the world.. ");
printf("\nGenre: Cartoon\n");
printf("Do you want to watch this movie:[y][n]\n");
scanf("%c",&choice1);
scanf("%c",&choice1);
if(choice1 == 'y'){
price();
break;
} else {
main();
}
break;
case 2:
printf("\nTitle: Transformers\n");
printf("Description:\n");
printf("Story starts when 5 robots that call themselves Autobots arrive on Earth. They tried to protect human from Decepticon which are evil.\nThey fought the Decepticon clan with all their might. Will the earth be saved by the Autobots...\nOr will the Earth fall to the hand of the Decepticon and human race extinct...");
printf("\nGenre: Scifi\n");
printf("Do you want to watch this movie:[y][n]\n");
scanf("%c",&choice1);
scanf("%c",&choice1);
if(choice1 == 'y'){
float price();
break;
} else {
main();
}
break;
case 3:
printf("\nTitle: Don't Break My Heart...\n ");
printf("Description:\n");
printf("Don't Break My Heart is a story about a young girl named Elizabeth that doesn't believe in love anymore. At the age of 16, she's being played by the most handsome boy in her school.\nThe boy broke up with her in front of the school assembly making her embarrased to go to school after that situation. Luckily, a boy named Samuel like her but never reveal his true feelings.\nHe than help the girl to realise the happiness of love. Will the girl realise the true feelings of Samuel...");
printf("\nGenre: Romance\n");
printf("Do you want to watch this movie:[y][n]\n");
scanf("%c",&choice1);
scanf("%c",&choice1);
if(choice1 == 'y'){
float price();
break;
} else {
main();
}
break;
case 4:
printf("\nTitle: Meet The Robinson\n");
printf("Description:\n");
printf("Meet The Robinson is a Disney cartoon that tells us about a lonely orphan is being attacked by his enemy from the future. He is than help by his own son from the future.\nHe has to help his son so his enemy does not change the past. He help his son defeat his true enemy by time travelling.\nHis enemy who's actually his childhood friend realise that he is being used. He then switches sides and defeated their true enemy.\nThis movie shows you how friendship help us defeat anything eventhough they are far away.");
printf("\nGenre: Cartoon\n");
printf("Do you want to watch this movie:[y][n]\n");
scanf("%c",&choice1);
scanf("%c",&choice1);
if(choice1 == 'y'){
float price();
break;
} else {
main();
}
break;
case 5:
printf("\nTitle: Good Night!!\n");
printf("Description:\n");
printf("Good Night!! is a horror story about a ghost who live in peoples dream. Once he entered the dream, it will come out until the dreamer died.\nYou cannot get out of the dream unless you are awake before the final sign. If you get to see this ghost what will you do?\nFind out how they defeat the ghost inside the dream..");
printf("\nGenre: Horror\n");
printf("Do you want to watch this movie:[y][n]\n");
scanf("%c",&choice1);
scanf("%c",&choice1);
if(choice1 == 'y'){
float price();
break;
} else {
main();
}
break;
case 6:
printf("\nThank you!!\nGood bye\n");
default:
printf("Invalid choice...\n");
printf("\n\n Do you wish to continue?[y][n]: ");
scanf("%c", &decision1);
if(decision1 == 'y'){
main();
} else {
printf("\n\n Thank You!!\nGood bye\n");
break;
}
break;
}
system("pause");
return 0;
}
float price(){
printf("\n\tPrice: Adult: RM12.00\n\tChildren: RM8.00\n");
printf("How many adult: \n");
scanf("%d", &adult);
printf("How many kids: \n");
scanf("%d", &kids);
printf("You have %d adult and %d kids\n", adult, kids);
total=(adult*padult)+(kids*pkids);
printf("Select seats: \n");
float seats();
printf("Total= RM .2%f\n", total);
return total;
}
最佳答案
您的代码中有很多问题。仅举几例:
scanf("%c",&choice1);
将考虑按 enter 键。
情况 5 float 价格();
--> 不正确。
if(decision1 == 'y'){ main(); }
--> 使用标志和 do..while()
等等。等等
此外,将所有内容都放在main中并不是一个很好的做法。为了清理代码并增强可读性,如何为每个 case
创建单独的函数并从 switch
case 调用它们?
关于检查 C 编程代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25764359/
我尝试理解[c代码 -> 汇编]代码 void node::Check( data & _data1, vector& _data2) { -> push ebp -> mov ebp,esp ->
我需要在当前表单(代码)的上下文中运行文本文件中的代码。其中一项要求是让代码创建新控件并将其添加到当前窗体。 例如,在Form1.cs中: using System.Windows.Forms; ..
我有此 C++ 代码并将其转换为 C# (.net Framework 4) 代码。有没有人给我一些关于 malloc、free 和 sprintf 方法的提示? int monate = ee; d
我的网络服务器代码有问题 #include #include #include #include #include #include #include int
给定以下 html 代码,将列表中的第三个元素(即“美丽”一词)以斜体显示的 CSS 代码是什么?当然,我可以给这个元素一个 id 或一个 class,但 html 代码必须保持不变。谢谢
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我试图制作一个宏来避免重复代码和注释。 我试过这个: #define GrowOnPage(any Page, any Component) Component.Width := Page.Surfa
我正在尝试将我的旧 C++ 代码“翻译”成头条新闻所暗示的 C# 代码。问题是我是 C# 中的新手,并不是所有的东西都像 C++ 中那样。在 C++ 中这些解决方案运行良好,但在 C# 中只是不能。我
在 Windows 10 上工作,R 语言的格式化程序似乎没有在 Visual Studio Code 中完成它的工作。我试过R support for Visual Studio Code和 R-T
我正在处理一些报告(计数),我必须获取不同参数的计数。非常简单但乏味。 一个参数的示例查询: qCountsEmployee = ( "select count(*) from %s wher
最近几天我尝试从 d00m 调试网络错误。我开始用尽想法/线索,我希望其他 SO 用户拥有可能有用的宝贵经验。我希望能够提供所有相关信息,但我个人无法控制服务器环境。 整个事情始于用户注意到我们应用程
我有一个 app.js 文件,其中包含如下 dojo amd 模式代码: require(["dojo/dom", ..], function(dom){ dom.byId('someId').i
我对“-gencode”语句中的“code=sm_X”选项有点困惑。 一个例子:NVCC 编译器选项有什么作用 -gencode arch=compute_13,code=sm_13 嵌入库中? 只有
我为我的表格使用 X-editable 框架。 但是我有一些问题。 $(document).ready(function() { $('.access').editable({
我一直在通过本教程学习 flask/python http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-wo
我想将 Vim 和 EMACS 用于 CNC、G 代码和 M 代码。 Vim 或 EMACS 是否有任何语法或模式来处理这种类型的代码? 最佳答案 一些快速搜索使我找到了 this vim 和 thi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve this
这个问题在这里已经有了答案: Enabling markdown highlighting in Vim (5 个回答) 6年前关闭。 当我在 Vim 中编辑包含 Markdown 代码的 READM
我正在 Swift3 iOS 中开发视频应用程序。基本上我必须将视频 Assets 和音频与淡入淡出效果合并为一个并将其保存到 iPhone 画廊。为此,我使用以下方法: private func d
pipeline { agent any stages { stage('Build') { steps { e
我是一名优秀的程序员,十分优秀!