c++ - C++ 程序在某些行之后没有正确编译 [cout 语句]
问题描述
我是 C++ 新手并使用 minGW 版本 6.3.0-1。我无法编译此代码。
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int r, c, a[5][5];
cout << "Test loop";
for (int x = 1; x <= 6; ++x)
{
cout << "Value of variable x is: " << x << endl;
}
cout << "Test loop ends" << endl;
cout << "Enter the number of rows and columns:";
cin >> r >> c;
for (int i = 0; i < r; ++i)
{
for (int j = 0; j < c; ++j)
{
cout << "Enter the array element:";
cin >> a[i][j];
}
}
cout << "The array you entered:" << "\n order:" << r << "x" << c;
for (int i = 0; i < r; ++i)
{
for (int j = 0; j < c; ++j)
{
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
getch();
}
还请帮助找出我当前使用的 C++ 标准。
解决方案
return 0; getch(); }
在main()
等待使用getch()
. 切换这两行:
getch();
return 0;
}
另外请帮助找出我当前使用的 C++ 标准。
如果您-std
在编译代码时未指定,则 gcc 6.3 默认为 -std=gnu++14
这意味着您正在使用带有 GNU 扩展的 C++14。有关更多详细信息,请参阅文档。
推荐阅读
- c# - jQuery 数据表搜索文本
- javascript - 在使用 javascript 函数过滤掉某些行后,如何将 CSS 应用于奇数/偶数可见行?(错误地标记为重复)
- javascript - 当我们在javascript中将字符串变量初始化为null或空字符串时有什么区别?哪个是首选
- c++ - 由于 X509 重新定义问题,编译 WebRTC 和 boost::uuid 时出现问题。我应该在哪里创建问题?
- google-sheets - 如果另一个单元格的值为零,是否有一个公式可以用来返回 0 值?
- r - 使用数据框中的因子名称和级别顺序的变量更改 R 中的因子级别
- scala - Scala 中 TypedDataset 和类型边界的隐式编码器
- selenium - 获取以下代码的“元素不可交互”
- python - 在 TensorFlow 中沿一个轴应用排列
- angular - 为什么 ng serve 会导致 JS 文件出现 404 错误?