在复制的代码中查看我的评论:
void show(const double a[], unsigned els) { // a is const size_t index = 0; for (index = 0; index < els; index++) { cin >> a[index]; // you're trying to write to a const array }