-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
98 lines (96 loc) · 2.11 KB
/
main.cpp
File metadata and controls
98 lines (96 loc) · 2.11 KB
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
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
string user;
bool loggedin=false;
void createaccount(){
string username;
string g;
bool c=true;
ifstream gabrieliscool;
cout<<"Create a username. Must be under 12 characters (Please keep in mind that anyone can view this on github and replit)> ";
cin>>username;
gabrieliscool.open("accounts.txt");
while(getline(gabrieliscool, g)){
if(g.find(" ")<1844674407370955161){
cout<<"username cannot contain spaces";
}
if(g.length()>12){
cout<<"username too long\n";
c=false;
break;
}
if(username==g){
cout<<"Username Taken\n";
c=false;
break;
}
}
if(c){
ofstream createaccount;
createaccount.open("accounts.txt", ios::app);
createaccount << username << endl;
createaccount.close();
cout << "Account created!" << endl;
user=username;
loggedin=true;
}
};
void verifyAccount(){
loggedin=false;
ifstream accounts;
accounts.open("accounts.txt");
string g;
string check;
while(getline(accounts, g)){
cout<<"what is your username? ";
cin>>check;
if(check==g){
cout<<"Username correct\n";
loggedin=true;
}else{
cout<<"Username incorrect\n";
};
};
};
void game(){
;;string i;
;;cout<<"type in 10 and then press enter> ";
;;cin>>i;
;;if(i=="10"){
;;;;cout<<"you win\n";
;;}else if(i=="kyrus" || i=="Kyrus"){
;;;;cout<<"you super lose\n";
;;}else if(i=="winston" || i=="Winston"){
;;;;cout<<"\n | \n | \nO O\n";
;;}else if(i=="teddy"||i=="Teddy"){
;;;;cout<<"\n*floogles*\n";
;;}else if(i=="2147483647"){
;;;;cout<<"\nWarning: 32-bit integer limit has been reached. Shutting down\n";
;;}else{
;;;;cout<<"you lose\n";
;;};
};
int main(){
string l;
cout<<"Do you want to:\n1) Create an Account \n2) Log in\n3) Play The Game\n4) Mystery option\n";
while(true){
cin>>l;
if(l=="1"){
createaccount();
}else if(l=="2"){
verifyAccount();
}else if(l=="3"){
if(loggedin){
game();
}else{
cout<<"You Need to log in\n";
}
}else if(l=="4"){
cout<<"Umm...\nThere is no option 4 \nWhat should I do?\nI know!\nShutting down\n\n";
break;
};
cout<<"Enter 1, 2, or 3 ";
};
};