Skip to content

Commit

Permalink
Merge pull request #29 from kunalshah017/windows_experimental
Browse files Browse the repository at this point in the history
BUG: windows error fixed
  • Loading branch information
kunalshah017 committed May 14, 2023
2 parents 584f2ee + 502aa70 commit 9d14f08
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include <ctime>
#include <random>
#include <fstream>
#include <unistd.h>
#ifdef _WIN32
#include <conio.h>
#include <windows.h>
#else
#include <termios.h>
#include <unistd.h>
#endif

using namespace std;
Expand Down Expand Up @@ -101,9 +102,15 @@ class account
cout << "\n\nSet Forgot Pin Question \nName of your First School ? :- ";
getline(cin, fpin);

#ifdef _WIN32
srand(time(NULL));
AccountNumber = rand() % random + 1000000;
#else
srand(time(NULL));
AccountNumber = rand() % random + 1;

#endif

do
{
file.seekg(0, ios::beg);
Expand All @@ -119,8 +126,14 @@ class account

if (found)
{
#ifdef _WIN32
srand(time(NULL));
AccountNumber = rand() % random + 1000000;
#else
srand(time(NULL));
AccountNumber = rand() % random + 1;

#endif
}
} while (found);

Expand Down Expand Up @@ -962,7 +975,11 @@ class account
#endif
cout << "Exporting Data File " << c << "%";
cout.flush();
#ifdef _WIN32
Sleep(25);
#else
usleep(10000);
#endif
}

#ifdef _WIN32
Expand Down

0 comments on commit 9d14f08

Please sign in to comment.