無法得到這個工作......路障....幫助?!?我是新手,正在嘗試在Delco CC上爲C++課程編寫遊戲代碼。任何幫助將不勝感激。當它運行時,它不會像循序漸進一樣循環,因此我無法繼續編碼我的遊戲其餘部分。我工作在這個C++代碼上,不能讓它工作......看下面
#include<iostream>
#include<string>
using namespace std;
int findMap()
{
int space;
cout<<"| 1 | 2 | 3 |"<<endl;
cout<<"|_____|_____|_____|"<<endl;
cout<<"| 4 | 5 | 6 |"<<endl;
cout<<"|_____|_____|_____|"<<endl;
cout<<"| 7 | 8 | 9 |"<<endl;
cout<<"| | | |"<<endl;
cout<<"What space is your map in?"<<endl;
cin>> space;
if (space == 4||8)
{
cout<<"Nope! There's nothing in here."<<endl;
return findMap;
}
if (space == 5||6)
{
cout<<"Tough luck, you only found blank map paper. It's
useless."<<endl
return findMap;
}
if (space == 1||7)
{
cout<<"You found poision gas. You failed."<<endl;
return 0;
}
if (space == 1)
{
cout<<"Yippie! You found your map!"<<endl;
}
if (space == 9)
{
cout<<"Well, you found your wallet..."<<endl;
return findMap;
}
}
int game(findMap)
{
string name;
int findMap;
cout<<"It appears that you have been lost at sea."<<endl;
cout<<"But don't worry, you'll only have to survive until you reach
land, for this round."<<endl;
cout<<"Anyways, why don't you tell me your name?"<<endl;
cin>> name;
cout<<"Well, "<< name<<", do yourself a favour and find your
map..."<<endl;
cout<<findMap<<endl;
}
我沒有看到代碼中的任何一個循環。請發佈[SSCCE](http://sscce.org) – NathanOliver
現在我看到你正試圖調用findMap - 你沒有正確調用它。這是否編譯了很多警告?如果是,請閱讀。 –
你的問題是什麼? –