问题描述
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#define L 70 // IF THIS NUMBER IS MORE,LIKE 100,I GET "-1073741819 (0xC0000005)" Error code
int main()
{
srand(time(NULL));
int day=365,randomPersonRow=0,randomPersonColumn=0;
double beta=0.7,gamma=0.1,odds=0.0; //Gamma = healing chance,Beta = chance for getting sick
int SensitiveCount,SickCount,HealedCount;
int population[L][L];
SensitiveCount=(L*L)-1;SickCount=1;HealedCount=0;
int i,j,v,u;
for(i=0; i<L; i++) {
for(j=0;j<L;j++) {
population[i][j]=0;
}
}
randomPersonRow=(rand()%L);
randomPersonColumn=(rand()%L);
population[randomPersonRow][randomPersonColumn]=1; //first sick person - generated random
FILE *fp;
fp = fopen("result.dat","w");
for(v=1; v<=day; v++){ //365 days
for(u=0;u<=L*L;u++){ //1 day
randomPersonRow=(rand()%L); //Find a random person to see if he is sick or not
randomPersonColumn=(rand()%L); //Find a random person to see if he is sick or not
//for(i=0; i<L; i++) {
//for(j=0;j<L;j++) {
if(population[randomPersonRow][randomPersonColumn]==0){ //0 means he is Sensitive,and not sick or healed yet
if(population[randomPersonRow+1][randomPersonColumn]==1){ // If he meets a sick person in his "matrix" - 4 chance(up,down,left,right)
odds=((double) rand() / (RAND_MAX));
if(odds<=beta){
population[randomPersonRow][randomPersonColumn]=1; // He is getting sick,if he has been in contact with a sick person
SensitiveCount=SensitiveCount-1;SickCount=SickCount+1;
}
}
else if(population[randomPersonRow][randomPersonColumn+1]==1){
odds=((double) rand() / (RAND_MAX));
if(odds<=beta){
population[randomPersonRow][randomPersonColumn]=1; // He is getting sick,if he has been in contact with a sick person
SensitiveCount=SensitiveCount-1;SickCount=SickCount+1;
}
}
else if(population[randomPersonRow-1][randomPersonColumn]==1){
odds=((double) rand() / (RAND_MAX));
if(odds<=beta){
population[randomPersonRow][randomPersonColumn]=1; // He is getting sick,if he has been in contact with a sick person
SensitiveCount=SensitiveCount-1;SickCount=SickCount+1;
}
}
else if(population[randomPersonRow][randomPersonColumn-1]==1){
odds=((double) rand() / (RAND_MAX));
if(odds<=beta){
population[randomPersonRow][randomPersonColumn]=1; // He is getting sick,if he has been in contact with a sick person
SensitiveCount=SensitiveCount-1;SickCount=SickCount+1;
}
}
}
if(population[randomPersonRow][randomPersonColumn]==1){ // 1 = If the random person is sick
odds=((double) rand() / (RAND_MAX));
if(odds<=gamma){
population[randomPersonRow][randomPersonColumn]=2; // He is healed Now,if the odds are less then the random gamma value.
SickCount=SickCount-1;HealedCount=HealedCount+1;
}
}
//}
//}
}
if(fp!=NULL){
fprintf(fp,"%d; %d; %d; %d; \n",SensitiveCount,HealedCount); // writing to file
}else{
printf("Error!");
}
}
fclose(fp);
return 0;
}
仅具有“短选项”。
根本没有“长期权”吗?
如何知道缩写的含义?
例如,doxyen -h
中g
的含义。
解决方法
doxyen的命令没有长选项吗?
联机帮助页中未提及任何内容,但是文档站点中提到了--version
和--help
。我检查了源代码;这是仅有的两个长选项。
如何知道缩写的含义?
列出了这些选项,其含义在文档中进行了描述。
例如,
doxyen -g
中'g'的含义。
文档说:
- 使用doxygen生成模板配置文件:
doxygen [-s] -g [configName]