因为 “123” 是常量 是无法修改的
发个程序块你参考一下:
#include
using namespace std;
int main()
{
int i;
char *pcity[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
char **pcity;
cout<<"输入数值(1~7):";
cin>>i;
pcity=pcity+i-1;
cout<<*pcity<
}
#include
using namespace std;
int main()
{
char pcity[16] = "123"; //
cout << "input " << endl;
cin >> pcity;
cout << "output " << pcity << endl;
}