#include<stdio.h>
#include<time.h>
#include<string.h>
#include <stdlib.h>
///////////////////////
#define lane 1000
#define car_num 50
#define time_count 1000
#define pi 0.3
#define vmax 5
#define mg 125000
#define r 0.52
void inicars();
void move();
int FindFront(int);
int v[car_num][lane];
int p[car_num]; //location with p[i];
int a[car_num]; // 加速度
void main()
{ int k;
srand(time(0));
inicars();
for (k = 0; k < time_count; k++)
{
move();
fprintf(h, "时间:%2d\n", k);
}
fclose(h);
printf("OK");
getchar();
}
void inicars()
{
int i, j, n, t, temp_1, temp_3;
int m = 1;
for (n = 0; n < car_num; n++)
{
p[n] = rand() % lane;
// scanf("第一次检验:%2d", &k);
for (i = 0; i < n; i++)
{
if (p[n] == p[i])
{
m = 0;
printf("%2d", n);
scanf("%2d", &temp_3);
}
}
if (m == 0)
{
n--;
}
printf("%2d ,%2d\n", n, p[n]);
}
[此贴子已经被作者于2018-9-12 16:55编辑过]