-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (33 loc) · 858 Bytes
/
main.cpp
File metadata and controls
39 lines (33 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// main.cpp
// ds_hw1_warm_up
//
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include "PrimeChecker.h"
using namespace std;
PRIMECHECKER checker;
int main(int argc, char** argv){
//input file
ifstream fin;
fin.open("example", ios::in);
if(!fin){
cout << "Where is the pattern file given by TA ?????" << endl;
exit(-1);
}//input file
clock_t t_start, t_end;
t_start=clock();
int num, total_num=0, correct_num=0;
unsigned long a, b, check;
while( fin >> a >> b >> check ){
total_num++;
if( check==checker.PrimeChecker(a, b) ){correct_num++;}
}
fin.close();
t_end=clock();
cout<<"Total use "<<double(t_end-t_start)/CLOCKS_PER_SEC<<" secs"<<endl;
cout<<"Total pass "<<double (correct_num*100)/total_num<<" percentages of cases"<<endl;
return 0;
}