我正在製作一個RPG。 當我輸入代碼(如下所示) 我得到這個錯誤。 我在做什麼錯?main.cpp | 15 |錯誤:從'const char *'無效轉換爲'char'[-fpermissive] |製作遊戲時出錯
main.cpp | 15 |錯誤:從'const char *'無效轉換爲'char'[-fpermissive] |
#include <iostream>
#include <stdio.h>
#include <string>
#include <windows.h>
using namespace std;
int mainLoop()
{
char arr[4] = {'x', 'x', 'x', 'x'};
int pp = 1;
bool end = false;
string inp;
arr[pp] = "S";
while(end == false)
{
cout << arr << endl;
cout << ">>: " << endl;
cin >> inp;
if(inp == "move")
{
pp++;
}
}
}
int main()
{
mainLoop();
return 0;
}
編輯:
謝謝!但現在我把它留給舊的pp(球員位置)爲S. 我嘗試了一個新的變量ppold,並將pp-1更改爲x,但沒有任何反應。
男人,聽我的勸告:先學習編碼,然後開始製作遊戲。 – cubuspl42 2012-08-17 11:43:15