C++ error

来源:百度知道 编辑:UC知道 时间:2024/06/14 06:50:59
void putdata( double woker[][5],int n){
int i,j;
for(i=0;i<n;i++)
cout<<'k'<<i+1<<"的工资:";
for(j=0;j<4;j++)
cin>>woker[i][j]>>endl;
}

d:\text\pay\pay.cpp(24) : error C2679: 二进制“>>” : 没有找到接受“<未知>”类型的右操作数的运算符(或没有可接受的转换)

void putdata( double woker[][5],int n){
int i,j;
for(i=0;i<n;i++)
{
cout<<'k'<<i+1<<"的工资:";
for(j=0;j<4;j++)
cin>>woker[i][j];
}
}
你那样worker[i][j]中的i会是固定的n-1,没进入循环

cin>>woker[i][j]>>endl; //输入语句不用加endl
cin>>woker[i][j]; 这样即可

输入语句不用换行。
cin>>woker[i][j];//不用加>>endl;
用cin读入数据,自动换行的。
常识哦~