if (ii == 3){//车辆只停了一个小时,有3/4的概率离场
srand((unsigned)time(NULL)*100);
int a = 1+rand() % 4;
int b = 1+rand() % 4;
int c = 1+rand() % 4;
cout << "++++3 " << a << "++++" << endl;//用作测试判断是否离场函数
cout << "++++3 " << b << "++++" << endl;
cout << "++++3 " << c << "++++" << endl;
cout << "*************" << endl;
if ((a == 1 && b == 2 && c == 3)||(a==2&&b==1&&c==3)||(a==3&&b==2&&c==1)||(a==3&&b==2&&c==1))
return true;
else
return false;
}
Just like this picture, the program gives me the same number ,but I need different numbers , how can I do it.
#ifndef Head_H
#define Head_H
#include<stdlib.h>
#include<iostream>
#include<time.h>
#define PathSize 5
#define ParkSize 10
#define Price 5
using namespace std;
srand((unsigned)time(NULL));