repl.it
@BrandonGreen5/

DHLDataEntryLogin

C++

This is only the user and password information.

fork
loading
Files
  • main.cpp
  • zones and units
main.cpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <iostream>
#include <fstream>
#include <string>

using namespace std;


bool IsLoggedIn()

{
    string username, password, un, pw; 

    cout << " Enter Username:  ";
    cin >> un;
    cout << "Enter Password:  ";
    cin >> pw; 

    ifstream read ("data//" + un +".txt");
    getline(read, username);
    getline(read,password);
    if ( un == username && pw == password)
{
  return true;

}
else
{
  return false;

}

}

int main ()
{
  int choice;
  cout << "1:Register\n2:Login\nYour choice:  ";
  cin>> choice;
  if ( choice == 1)
  {
      string username, password;

      cout <<"Select a username:  ";
      cin  >> username;
      cout << "Select a password:  ";
      cin  >> password;



      


      ofstream file;

      file.open("data//" + username +".txt");
      file << username << endl << password;
      file.close();
      main();

file.open (username + ".txt");
ifstream read (un + ".txt");





  }
  else if ( choice == 2)
  { 
      bool status = IsLoggedIn();
      if (!status)
      {

        cout << " Failed Login!" << endl;
        system("Pause");
      }
      else 
      {

        cout << " Successfully Logged In!" << endl;
        system("PAUSE");
        return 1;
      }


      
      }
      return 0 ;
  
}

While( true)

{
  cout << " Enter zone: ";
  //Get zone and info about hours and units for this zone
  cout<< " Enter another zone? (y/n)"
  string response;
  cin>>response;
  if(response=="n")
{
  break;

}




}