有人可以在 c++ 中解释数组的这种输入

Can someone explain this input of array in c++

本文关键字:数组 输入 解释 c++      更新时间:2023-10-16

这是我的代码,数组的输入是什么?我只是想了解更多关于此代码中的输入的信息

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 遍历二维数组的所有行,并分别为第 1 和第 2 个位置获取 2 个输入。 第三个位置始终设置为 1。