有人可以在C ++中解释此数组输入

时间:2018-10-12 07:26:39

标签: c++ arrays

这是我的代码,数组的输入是什么?我只想更多地了解这段代码中的输入

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

  }

1 个答案:

答案 0 :(得分:0)

您正在采用这种形式的值

数组C

x  y  1
x1 y1 1
.
.
.
x9 y9 1

基本上,您遍历二维数组的所有行,并分别为第一位置和第二位置获取2个输入。第三位置始终设置为1。