所以我正在制作一个程序来制作一个像Zork一样的控制台运行文本视频游戏。而且我想把它打开,因为你可以输入“Walk Away”,它会理解。这是我的计划:
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
wchar_t Choice;
using namespace std;
int main()
{
int Choice;
{
printf("Welcome to Text Adventure Game!\n\n");
printf("To play just read the text and enter in the numberic value (i.e. 1, 2, or 3)\nto make a decision. Your decesions will be reflected as you continue on in the game.\n\n\n");
printf("Creators: Dillon Dugan and Justin Doubt.\n\n\n");
printf("If there is a problem with your game, please contact us on twitter @DillonMDugan or through e-mail at dillonmdugan@yahoo.com.\n\n\n");
printf("Enjoy.\n\n\n");
system("PAUSE");
printf(" \n\n\n\n\n");
printf("You come out of darkness.\nConfused and tired, you walk to an abandoned house.\nYou walk to the door.\n");
printf("What do you do?\n1. Walk Away.\n2. Jump.\n3. Open Door.\n\n");
string Choice;
cin>>Choice;
cin.ignore();
printf("\n\n\n");
switch(Choice)
{
case 'Walk_Away':
{
//Walks Away
printf("The House seems too important to ignore.\n");
printf("What do you do?\n1. Jump.\n2. Open Door.\n\n");
printf(" \n\n\n");
}
}
}
}
我收到的错误是在第29行,“错误:切换数量不是整数
你可以帮我解决这个问题吗?如果我做错了什么(除了使用printf),请告诉我