Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Textcomparer crated by Emil "BubbleQ" Dahlqvist and with lot of help from Chris, a danish guy.
- #include<iostream>
- #include<fstream>
- #include<string>
- #include<windows.h>
- using namespace std;
- int main()
- {
- //Vilka strängar som skall få vara med och vilka två som skall höra ihop med varandara :)
- string a_crackbone;
- string b_crackbone;
- string a_textname;
- string b_textname;
- ifstream fsFileIn;
- ifstream fsFileInTwo;
- // Beatiful colors <3
- HANDLE rainbow = GetStdHandle(STD_OUTPUT_HANDLE);
- //Get filename and make it into one of my strings
- SetConsoleTextAttribute(rainbow,15);
- cout << "Enter the first text or cfg file here, with .txt ending!: ";
- getline(cin,a_textname);
- // Gonna fix so that you don´t have to relaunch the program every time you hit wrong filename
- fsFileIn.open(a_textname.c_str());
- if(!fsFileIn.is_open())
- {
- cout << "Error: Couldn't open file: " << a_textname << endl;
- cin.get();
- return 0;
- }
- else
- {
- cout << "Reading from file: " << a_textname << endl;
- //Read file and print to console
- while(!fsFileIn.eof())
- {
- getline(fsFileIn,a_crackbone);
- SetConsoleTextAttribute(rainbow,3);
- cout << a_crackbone << endl;
- }
- SetConsoleTextAttribute(rainbow,15);
- cout << "Succesfully loaded file nr 1, now press ENTER to confirm." << endl;
- }
- cin.get();
- // *************GET THE OTHER TEXT!****************************************************************************************************
- //Get filename and make it into one of my strings
- cout << "Great! Now enter the second text/cfg file here, also with the .txt ending!: ";
- getline(cin,b_textname);
- // Gonna fix so that you don´t have to relaunch the program every time you hit wrong filename
- fsFileInTwo.open(b_textname.c_str());
- if(!fsFileInTwo.is_open())
- {
- cout << "Error: Couldn't open the second file: " << b_textname << endl;
- cin.get();
- return 0;
- }
- else
- {
- cout << "Reading from file: " << b_textname << endl;
- //Read file and print to console
- while(!fsFileInTwo.eof())
- {
- getline(fsFileInTwo,b_crackbone);
- SetConsoleTextAttribute(rainbow,3);
- cout << b_crackbone << endl;
- }
- SetConsoleTextAttribute(rainbow,15);
- cout << "Succesfully loaded file nr 2, press enter to start the comparsion!" << endl;
- }
- cin.get();
- // Now will shall compare them!!!!!!!!! Wohoo! After the guy has presed enter!
- if( a_crackbone == b_crackbone )
- {
- SetConsoleTextAttribute(rainbow,2);
- cout << "Both files matches perfectly, lucky for you!" << endl;
- }
- else
- {
- SetConsoleTextAttribute(rainbow,4);
- cout << "The files does not match eachother, too bad." << endl;
- }
- SetConsoleTextAttribute(rainbow,2);
- return 0;
- }
Add Comment
Please, Sign In to add comment