RPGを作っています。コード(以下に示す)を入力すると、このエラーが発生します。私は何を間違っていますか?
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 に変更しようとしましたが、何も起こりません。