Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <Windows.h>
- #include <fstream>
- #include "MenuFunctions.h"
- using namespace std;
- void MenFunctions::Add() {
- system("cls");
- cout << "Write your name and surname: ";
- cin >> name >> surname;
- cout << "Now we will generate a PIN that you will use to login to our system. \n";
- cout << "You can change it whenever you want! \n";
- //Generate();
- cout << "OK, here is your PIN: " << PIN << ". Remember it! That let you login to our system! \n";
- cout << "Now log in to our system. \n";
- system("pause");
- system("cls");
- return Menu();
- }
- void Menu() {
- cout << "------GUBE BANK------ \n\n";
- cout << "---------------------\n";
- cout << "1. Log in\n";
- cout << "2. Create an account\n";
- cout << "3. Exit\n";
- cout << "---------------------\n\n";
- cout << "Choose an option <1-3>: ";
- int choose;
- cin >> choose;
- switch (choose) {
- case 1: {
- //login();
- }
- break;
- case 2: {
- //Add();
- }
- break;
- }
- }
- void MenFunctions::Generate() {
- srand(time(NULL));
- for (int i = 1; i <= 6; i++)
- {
- PIN = rand() % 49 + 1;
- Sleep(1000);
- }
- }
- void MenFunctions::SaveContent() {
- fstream plik;
- plik.open("DANE.bnk", ios::out | ios::app);
- plik << name << endl;
- plik << surname << endl;
- plik << PIN << endl;
- plik.close();
- }
- void MenFunctions::ReadContent() {
- string linia;
- int nr_linii = 1;
- fstream plik;
- plik.open("DANE.bnk", ios::in);
- if (plik.good() == false) cout << "Nie mozna otworzyc pliku!";
- while (!plik.eof())
- {
- switch (nr_linii)
- {
- case 1: name = linia; break;
- case 2: surname = linia; break;
- case 3: PIN = atoi(linia.c_str()); break;
- }
- nr_linii++;
- }
- plik.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement