yes i already complete...but how do i print my answer in to a binary file by "wb" commen?
this is the code;
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define num 10
double GetRandom(double min, double max)
{
return (rand() / (double)RAND_MAX) * (max - min) + min;
}
int GetChar(int iMin, int iMax)
{return rand() % (iMax - iMin + 1) + iMin;
}
struct DateType
{
int aircraft_ID[num];
double x[num];
double y[num];
double z[num];
};
int ReadDate(struct DateType x)
{
int i;
srand((unsigned int)time(NULL));
for(i=0;i<num;i++){
x.y[i] = GetRandom(-100,100);
x.x[i] = GetRandom(-100,100);
x.z[i] = GetRandom(-50,50);
}
for(i=0;i<num;i++)
{
printf("%c%c%c%c%c, x = %f, y = %f,z = %f\n",GetChar(65,90),GetChar(65,90),GetChar(48,57),GetChar(48,57),GetChar(48,57),x.x[i],x.y[i],x.z[i]);
}
}
int main(void)
{
struct DateType x;
ReadDate(x);
getch();
return 0;
}