Advertisement
Guest User

Untitled

a guest
May 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. /**
  2. Simple string program for chatting.
  3.  
  4. Ok, so anyways..the program doesn't save when you close it, which will be fixed.
  5. This is the basic source code, and took awhile to make.
  6.  
  7. Beta Features:
  8.  
  9. Login works great. (Still has a few bugs)
  10. Program is stable
  11. --------------------------------------------------------------------------------
  12. Beta To-Do-List:
  13.  
  14. Create Account Process Added
  15. Chat Process Added
  16. Connected to the net
  17. Graphics
  18. --------------------------------------------------------------------------------
  19. */
  20.  
  21. #include <iostream>
  22. #include <cstring>
  23.  
  24. using namespace std;
  25.  
  26. char username[25];
  27. char password[30];
  28. char email[50];
  29. char answer[10];
  30.  
  31. int loggedin = 0;
  32. int invalid = 0;
  33. int FriendsOnline = 0;
  34. int isdoingpassword = 0;
  35. int input;
  36.  
  37. int main()
  38. {
  39. // Some information on the program.
  40. printf("Thank you for using Chat Test Beta 1\n"); // Displays a print message (or outputs) I chose to use printf instead of cout
  41. printf("Your username and password is: UN: thebigdick123 PS: fuck\n\n");
  42. // The fun begins.
  43.  
  44.  
  45.  
  46. // If the username or password is invalid (1) this will happen
  47. if ( invalid == 1 ) {
  48. printf("Invalid username or password, please restart the program");
  49. cin.get();
  50. }
  51.  
  52.  
  53.  
  54. // This checks if the user is logged in
  55. if ( loggedin == 0 ) {
  56. printf("Username: ");
  57. cin.getline ( username, 25 ); // Reads the input for the username
  58.  
  59.  
  60.  
  61. // If the user is not typing in his/her's password
  62. if ( isdoingpassword == 0 ) {
  63. if ( strcmp ( username, "thebigdick123" ) == 0 ) // If the username is as listed above
  64. isdoingpassword += 1;
  65. else
  66. printf("Invalid username or password");
  67.  
  68.  
  69. cin.get(); // Waits for the user to press enter
  70. }
  71.  
  72.  
  73.  
  74. // If the user is typing in his/her password
  75. if ( isdoingpassword == 1 ) {
  76. printf("Password: ");
  77. cin.getline ( password, 30 ); // Reads the input for the username
  78. cin.ignore();
  79.  
  80.  
  81. if ( strcmp ( password, "fuck" ) == 0 ) // If the password is as listed above
  82. cout << "Welcome, " << username << "! You are now logged in.\n\n";
  83. loggedin += 1;
  84. }
  85.  
  86. }
  87. // If the user is logged in
  88. if ( loggedin == 1 ) {
  89. // Now in INT MAIN
  90. printf("Actions:\n");
  91. printf("1. Friends Online\n");
  92. printf("2. My Profile\n");
  93. printf("Selection: ");
  94. cin >> input;
  95. // Beginning my cases!
  96.  
  97. switch ( input ) {
  98.  
  99. case 1:
  100. if ( FriendsOnline <= 1 ) {
  101. printf("You have no friends online!");
  102. cin.get();
  103. } else if ( FriendsOnline >= 0 ) {
  104. cout << "You have " << FriendsOnline << " Online!";
  105. cin.get();
  106. }
  107. break;
  108. case 2:
  109. printf("This feature has not been added yet!");
  110. cin.get();
  111. break;
  112. default:
  113. printf("That option has not been added yet!");
  114. cin.get();
  115. break;
  116. }
  117. }
  118. cin.get();
  119. } // Int Main Closing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement