问题遇到的现象和发生背景
m的表达式的结果不是常数!错误c2131
用代码块功能插入代码,请勿粘贴截图
int main()
{
int i, m, k;
cout << "请输入需重排的车厢数:";
cin >> m;
int A[m], car;
cout << "请依次输入需重排的车厢序列编号:";
for (i = 0; i < m; i++)
cin >> A[i];
cout << "请输入缓冲轨(队列)的数目:";
cin >> k;
cout << endl;
CTrackStation trackStation;
bool ok = false;
do
{
InitCTrackStation(trackStation, k);
if (RealignCTrackStation(trackStation, A, m))
{
ok = true;
cout << endl << "车厢已重排!" << endl;
}
else
{
DestroyCTrackStation(trackStation);
cout << "缓冲轨的数目为" << k << "时,因车厢无法重排,请重输缓冲轨的数目:";
cin >> k;
cout << endl;
}
} while (!ok);
DestroyCTrackStation(trackStation);
system("pause");
return 0;
运行结果及报错内容
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2131 表达式的计算结果不是常数 cardispatching