#include<stdio.h>
#include<time.h>
#include<stdlib.h>
float polje(float a[]);
int main()
{
int n;
float a[n];
printf("%d",polje(a));
return 0;
}
float polje(float a[])
{
int n,i;
scanf("%d",&n);
srand(time(NULL));
for(i=0;i<n;i++)
{
a[i]=(2*(-n))+rand()%((2*n)-(-2*n)+1);
if(a[i]>=n && a[i]<=0) i--;
}
return *a;
}
I need to make a programme with a function that will give me random numbers from -2n to 2n excluding numbers from n to 0. I need to allocate the memory for 800 float characters but I dont know how to do it. The compiler only warns about one mistake but im aware that the whole code is a mess.
9 5 C:\Users\x\Documents\saff.cpp [Error] cannot convert 'float' to 'float' in assignment
Aucun commentaire:
Enregistrer un commentaire