注意注意 int n; cin >> n; int num[n];发现错误没?n必须要在编译连接阶段确定如果想要n是随意的建议使用vector要加上头文件#include --修正-- int n; cin >> n;vectornum;num.resize(n);