|
#include "stdafx.h"
#include "iostream.h"
int maximum(int [],int);
void main()
{int a[]={34,91,83,56,29,93,56,12,88,72};
int len=sizeof (a)/sizeof (int);
for(int i=0;i<len;i++)
cout<<a[i]<<',';
cout<<endl;
cout<<"the answer is"<<"maximum(&a[0],len)";
int maximum(int grade[],int size)
{
int min=100;
for(int i=0;i<size;i++)
if(grade[i]<min)
min=grade[i];
return min;
}
出现问题是:
I:\VC++\10\10.cpp(19) : error C2601: 'maximum' : local function definitions are illegal
I:\VC++\10\10.cpp(27) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
10.exe - 2 error(s), 0 warning(s)
希望大家帮帮忙,本人刚学C++,菜得很 |
|