c++ - 有人可以用 C++ 解释这个数组的输入吗
问题描述
这是我的代码,这个数组的输入是什么?我只是想更多地了解这段代码中的输入
int n;
float c[10][3];
cout<<“Enter the number of vertices :”;
cin>>n;
for (i=0;i<n;i++)
{
cout<<“Enter the coordinates of the vertex :”,i+1;.
cin>>c[i][0]>>c[i][1];
c[i][2]=1
}
解决方案
您正在以这种形式取值
阵列 C
x y 1
x1 y1 1
.
.
.
x9 y9 1
基本上,您的 i 遍历二维数组的所有行,并分别为第一个和第二个位置获取 2 个输入。第三个位置始终设置为 1。
推荐阅读
- html - css 伪元素 ::selection 无法正常工作
- angular - Angular 2:监听指令内父元素的滚动事件
- javascript - 模板JS | 在组件中导入第三方脚本
- java - java计算字符串中的二元组数
- django - 在 django 项目中使用 xhtml2pdf 从 html 生成 pdf
- python - 当数据集太大时,Django 分页工作很慢
- maven - 如何通过 Maven 覆盖优先级较低的资源文件?
- odata - 为基于 CDS 的 OData 服务的 OData 更新添加业务逻辑
- c# - iOS 上 ListView 中奇怪的额外空间
- xamarin - 如何使用 Xamarin Android 每五秒录制一次视频并上传到服务器?