?? generator.cpp
字號:
#include <stdio.h>
#include <stdlib.h>
#include "Item.h"
#define NUM 3000//生成數據個數
#define FRACTION 1000000// 金額小數部分最大值
#define DEPOSIT 1000000000// 金額整數部分最大值
#define MONTH 500//月份最大值
#define CURRENT 0.03
#define FIXED 0.15
void main()
{
srand(1);
FILE * out=fopen("database.txt","w+");
int i;
Item tmp;
// fprintf(out, "%.2f %.2f\n", CURRENT, FIXED);
for(i=0;i<NUM;i++){
tmp.account=rand()*rand()%1000000000;
tmp.password=rand()*rand()%1000000;
int fraction=rand()*rand()%FRACTION;
int deposit=rand()%DEPOSIT;//不超過32767
if(rand()%2==1)
tmp.type='u';
else
tmp.type='f';
tmp.month=0;//初始化為0個月
fprintf(out, "%09d %06d %09d.%06d %c %03d\n" ,tmp.account ,tmp.password ,deposit ,fraction ,tmp.type ,tmp.month);
}
fclose(out);
out=fopen("interest.txt","w+");
fprintf(out,"000000000\n000000\n%lf\n%lf\n%d", FIXED, CURRENT, rand()%100);//最后一個是經過多少個月
fclose(out);
}
/*輸入為
"活期利率 定期利率\n"
第一個,帳號從000000001開始,順序下來
第二個
.
.
.
墓碑為999999999
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -