各位大哥我编了一个程序可为什么结果这样
程序代码:#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define SIZE 1000
void times(int a,int*c);
int mian(void)
{
int i;
int degree[10];
srand((unsigned int)time(0));
for(i=0;i<SIZE;i++)
times(rand() % 10 + 1,degree);
for(i=0;i<10;i++)
printf("%d",degree[i]);
return 0;
}
void times(int a,int*c)
{
if(a==1)
c[0]+=1;
if(a==2)
c[1]+=1;
if(a==3)
c[2]+=1;
if(a==4)
c[3]+=1;
if(a==5)
c[4]+=1;
if(a==6)
c[5]+=1;
if(a==7)
c[6]+=1;
if(a==8)
c[7]+=1;
if(a==9)
c[8]+=1;
if(a==10)
c[9]+=1;
}
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define SIZE 1000
void times(int a,int*c);
int mian(void)
{
int i;
int degree[10];
srand((unsigned int)time(0));
for(i=0;i<SIZE;i++)
times(rand() % 10 + 1,degree);
for(i=0;i<10;i++)
printf("%d",degree[i]);
return 0;
}
void times(int a,int*c)
{
if(a==1)
c[0]+=1;
if(a==2)
c[1]+=1;
if(a==3)
c[2]+=1;
if(a==4)
c[3]+=1;
if(a==5)
c[4]+=1;
if(a==6)
c[5]+=1;
if(a==7)
c[6]+=1;
if(a==8)
c[7]+=1;
if(a==9)
c[8]+=1;
if(a==10)
c[9]+=1;
}#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define SIZE 1000
void times(int a,int*c);
int mian(void)
{
int i;
int degree[10];
srand((unsigned int)time(0));
for(i=0;i<SIZE;i++)
times(rand() % 10 + 1,degree);
for(i=0;i<10;i++)
printf("%d",degree[i]);
return 0;
}
void times(int a,int*c)
{
if(a==1)
c[0]+=1;
if(a==2)
c[1]+=1;
if(a==3)
c[2]+=1;
if(a==4)
c[3]+=1;
if(a==5)
c[4]+=1;
if(a==6)
c[5]+=1;
if(a==7)
c[6]+=1;
if(a==8)
c[7]+=1;
if(a==9)
c[8]+=1;
if(a==10)
c[9]+=1;
}[local]1[/local]








