错误:一元'*'的无效类型参数(有'浮') 下面是它出现的功能。
这是我第一次使用指针,敬请期待进一步阅读
void printArray(float *array, int hours)
{
int x = hours;
cout << "Number of hours each student spent : " << endl;
for (x = 0; x <= size; x++)
{
cout << *array[x] << " " << endl;
^^ Error is here
}
}
第二个错误是 - 数组下标的无效tyoes'int [int]' 在此功能中找到
void getFBTData(int size, int hours)
{
for (int count = 0; count < size; count++)
{
cout << "Enter number if hours each student spent. " << count + 1;
cin >> hours[count];
^^ Error is here
}
cin.sync();
}
答案 0 :(得分:0)
嗯,你真的需要学习如何解除引用和下标。一些基本规则:
cout << *array[x] << " " << endl; //same as *(array[x]), cannot derefence float
array[x] //change to
cin >> hours[count]; //hours is int, cannot subscript
void getFBTData(int size, int *hours) //change to pointer