#include<stdio.h>
#include<stdlib.h>
void prn_random_numbers(int k);
int max(int a, int b); 这三行总是提示“说明语法错误”
int min(int a, int b);
int main(void)
{
int n;
printf("Some random numbers will be printed.\n");
printf("How many would you like to see?");
scanf("%d", &n);
prn_ramdom_numbers(n);
getch();
return 0;
}
void prn_random_numbers(int k)
{
int i, r, biggest, smallest;
r = biggest = smallest = rand();
printf("\n%7d", r);
for( i = 1; i < k; ++i){
if( i % 7 == 0)
printf("\n");
r = rand();
biggest = max(r, biggest);
smallest = min(r, smallest);
printf("%7d",r);
}
printf("\n\ns%5d\n%s%5d\n%s%5d\n\n",
" Count: ", k,
"Maximum: ", biggest,
"minimum: ",smallest);
}
int max(int a, int b)
{
if( a> b)
return a;
else
return b;
}
int min(int a, int b)
{
if(a < b)
return a;
else
return b;
}
我检查不出有什么错误,请大家帮忙检查!谢谢!