Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <fstream>
- #include <Windows.h>
- #include <string>
- #pragma warning( disable : 4996)
- using namespace std;
- int get_file_size(std::string file) // path to file
- {
- FILE *p_file = NULL;
- p_file = fopen(file.c_str(), "rb");
- fseek(p_file, 0, SEEK_END);
- int size = ftell(p_file);
- fclose(p_file);
- return size;
- }
- std::string username;
- std::string password;
- std::string buffer;
- std::ofstream outfile("username.txt");
- std::ifstream input("username.txt");
- int main() {
- while (std::getline(input, buffer))
- username += (buffer + '\n');
- while (std::getline(input, buffer))
- password += (buffer + '\n');
- string inputuser;
- string inputpass;
- cout << "Username: ";
- getline(cin, inputuser);
- if (inputuser == username)
- {
- cout << "Password: ";
- getline(cin, inputpass);
- if (inputpass == password){ cout << "Welcome Fellow Block gamer";}
- else { cout << "Incorrect Password"; Sleep(500); }
- }
- else{ cout << "Incorrect Username"; Sleep(500);}
- }
- std::ifstream::pos_type filesize(const char * filename)
- {
- return std::ifstream::pos_type();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement