I am planning to change the elements inside the array of my x[]
to cast out the number like 1, 2, 3, 4. But once i execute the code. it will show this error message.
error: no matching function for call to
std::__cxx11::basic_string<char>::basic_string(int&)
Please anyone can help me to do anything to change my elements inside instead of using for loop? I can change it one by one by I want to change it all together just in case to save time and the amount of code written.
#include <iostream>
using namespace std;
string x[] = {"X", "O", "X", "O"};
int main()
{
cout << x[0] + x[1] + x[2] + x[3] << endl;
for (int i = 0; i < 4; i++){
x[i] = (string)i;
}
cout << x[0] + x[1] + x[2] + x[3] << endl;
return 0;
}