#include <iostream>
#include <fstream>
#include <time.h>
#include <math.h>
using namespace std ;
int main() {
int count=0;//testcast number
double studentN;
int i;
long Dollar, Sent;
double spendMoney;
ofstream fout("testcase.txt") ;
srand( (unsigned)time(NULL));
while(count++ < 1000) {
studentN = rand()%1000;
fout.precision(0);
fout <<studentN<<endl;
for(i=0;i<studentN;i++)
{
Dollar = ((long)rand()<<15 | rand())%1000000 ;
Sent = rand()%100;
spendMoney = (double)(Dollar+(double)(Sent*0.01));
printf("$%.2d + $%.2d = $%.2f\n",Dollar,Sent,spendMoney);
fout.precision(2);
fout.setf(ios_base::fixed);
fout <<spendMoney<<endl;
}
}
fout<<'0'<<endl;
cout<<'0'<<endl;
fout.close() ;
return 0 ;
}
testcase.txt