Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. //precompiler directives:
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <fstream>
  5. #include <cmath>
  6. #include <math.h>
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include <string>
  10.  
  11. using namespace std;
  12.  
  13. // protos
  14. bool login();
  15. bool usnlogin();
  16. bool pwlogin();
  17.  
  18.  
  19. int main() {
  20. system("color 04");
  21. login();
  22.  
  23.  
  24.  
  25. }
  26.  
  27. bool login(){
  28. string usn,pw;
  29. string properusername = "Crypto";
  30. system("TITLE Crypto's Login Screen v1.0.0 [ALPHA]");
  31. //bool sucess1,sucess2 = false;
  32. cout<<"Hello and welcome to this application"<<endl<<endl<<"In order to use this program please enter your username and password"<<endl;
  33. //usnlogin();
  34. if(usnlogin() == true){
  35. //pwlogin();
  36. }
  37. else if(usnlogin() == false){
  38. cout<< "An error has occured"<<endl;
  39. exit(-1337);
  40. }
  41. if(pwlogin() == true){
  42. /////////////////////////////////////
  43. ///////////////ENTER THE PROGRAM CALL HERE/////////////
  44. ////////////////////////////////////
  45. cout<<"works"<<endl;
  46. Sleep(1000);
  47. exit(1);
  48.  
  49. }
  50. else if(pwlogin() == false){
  51. cout<<"An error has occured"<<endl;
  52. exit(-1338);
  53. }
  54.  
  55. }
  56.  
  57.  
  58. bool usnlogin(){
  59. string properusername = "Crypto";
  60. string usn;
  61.  
  62. // input of username
  63. cout<<"usn: ";
  64. cin>> usn;
  65. //error of username
  66. if(usn != properusername){
  67. cout<<"An error has occured. Either that USN is not registered to this build or it is spelled wrong"<<endl;
  68. cout<<"Please try again later or check for spelling mistakes"<<endl;
  69. return false;
  70. }
  71. //success.
  72. else if(usn == properusername){
  73. cout<<"...";
  74. system("color 3C");
  75. Sleep(1000);
  76. system("color 04");
  77. cout<<"Correct!"<<endl;
  78. return true;
  79.  
  80. }
  81.  
  82. }
  83.  
  84. bool pwlogin(){
  85. //deffiners
  86. string properpassword = "crypt";
  87. string pw;
  88. // inputs password
  89. cout<<"pw: ";
  90. cin>>pw;
  91. if(pw != properpassword){
  92. cout<<"An error has occured. Either that PW is not registered to this build or it is spelled wrong"<<endl;
  93. cout<<"Please try again later or check for spelling mistakes"<<endl;
  94. return false;
  95. }
  96. else if(pw == properpassword){
  97. cout<<"...";
  98. system("color 3C");
  99. Sleep(1000);
  100. system("color 03");
  101. cout<<"Correct!"<<endl;
  102. return true;
  103. }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement