【发布时间】:2009-11-12 00:29:27
【问题描述】:
'{'之前的预期不合格ID
我的代码中的这个错误在哪里?谢谢大家!
#include <iostream>
using std::cout;
using std::endl;
//function prototypes
void findsmallest (int[], int &);
void findsmallest (int scores [], int & min);
int main()
{
//declare variables
int smallest = 0;
int scores[20] = { 90, 54, 23, 75, 67,
89, 99, 100, 34, 99,
97, 76, 73, 72, 56,
73, 72, 65, 86, 90 };
findsmallest(scores, smallest);
return 0;
//call function find smallest
findsmallest (scores, smallest);
cout << "Minimum value in the array is " << smallest << endl;
system ("pause");
return 0;
}
//function definition
void findsmallest(int scores [], int & min);
{
min = scores[0];
int i;
for(i = 0; i < 20; i++)
{
if(scores[i] < min)
{
min = scores[i];
}
}
}
//end display findsmallest
system ("pause");
return 0;
【问题讨论】:
-
您的问题是什么?除了
//declare array,你的代码已经声明了一个数组。 -
我看到评论是格式问题。你所拥有的已经是正确的。
-
“我到底应该怎么做”。究竟要做什么?
-
考虑你的数组声明。
-
我看到你已经进行了更正,所以你已经是正确的,除非你没有很好地传达你的更正