-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilechecker.cpp
More file actions
60 lines (54 loc) · 1.19 KB
/
Copy pathfilechecker.cpp
File metadata and controls
60 lines (54 loc) · 1.19 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string>
#include <string.h>
using namespace std;
int main()
{
ifstream output,realoutput;
output.open("output.txt",ios::binary);
realoutput.open("realoutput.txt",ios::binary);
char string1[256], string2[256];
string getcontent;
int j = 0;
int flag =0;
while(!output.eof())
{
output.getline(string1,256);
realoutput.getline(string2,256);
j++;
if(strcmp(string1,string2) != 0)
{
flag = 1;
cout << j << "nd output doesnt match" << "\n";
cout << "Your Output: " << string1 << "\n";
cout << "Expected Output: " << string2 << "\n";
}
}
output.close();
realoutput.close();
if(flag == 0)
cout <<"All test cases passed successfully\n";
else{
output.open("output.txt");
cout << "Your Output: " <<endl;
if(output.is_open())
{
while(getline(output, getcontent))
{
cout << getcontent << endl;
}
}
realoutput.open("realoutput.txt");
cout << "Expected Output: " <<endl;
if(realoutput.is_open())
{
while(getline(realoutput, getcontent))
{
cout << getcontent << endl;
}
}
}
return 0;
}