rexinsteroids

reg na malapit nang matapos

Apr 7th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <cctype>
  3. #include <conio.h>
  4. #include <cstring>
  5. #include <stdlib.h>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. string user, password, userConfirmation, passwordConfirmation;
  11. string alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  12. string alphaLower = "abcdefghijklmnopqrstuvwxyz";
  13. string numer = "0123456789";
  14. string letter;
  15. char passwordTemp, passwordConfTemp;
  16. int length, check1 = 1, check2 = 1, check3 = 1, aUpCount = 0, aUpVer = 0, aLowCount = 0, aLowVer = 0, aNumCount = 0, aNumVer = 0, userVer = 0, passwordVer = 0;
  17.  
  18.  
  19. while (check1 != 0)
  20. {
  21. Registration:
  22. cout<<"REGISTRATION\n";
  23. cout<<"Username: ";
  24. getline(cin, user);
  25. system("cls");
  26. cout<<"REGISTRATION\n";
  27. cout<<"Username: "<<user<<endl;
  28. cout<<"Password: ";
  29. while (check2 != 0)
  30. {
  31. for ( ; ; )
  32. {
  33. passwordTemp = getch();
  34. if (passwordTemp == '\r')
  35. {
  36. break;
  37. }
  38. password += passwordTemp;
  39. cout<<"*";
  40. }
  41. cout<<endl<<password<<"<<FOR TESTING"<< endl;
  42. break;
  43. }
  44. length = password.length();
  45.  
  46. // checks if password is within 6-10 characters, repeats loop if not
  47. if ((length < 6) || (length > 10))
  48. {
  49. cout<<"DAPAT 6-10 WEW";
  50. password.clear();
  51. user.clear();
  52. goto Registration;
  53. }
  54. for (int a = 0; a < 25; a++)
  55. {
  56. for (int b = 0; b < length; b++)
  57. {
  58. letter = password.substr(b, 1);
  59. if (letter == alphaUpper.substr(a, 1))
  60. {
  61. aUpCount += 1;
  62. }
  63. }
  64. }
  65. for (int c = 0; c < 25; c++)
  66. {
  67. for (int d = 0; d < length; d++)
  68. {
  69. letter = password.substr(d, 1);
  70. if (letter == alphaLower.substr(c, 1))
  71. {
  72. aLowCount += 1;
  73. }
  74. }
  75. }
  76. for (int e = 0; e < 10; e++)
  77. {
  78. for (int f = 0; f < length; f++)
  79. {
  80. letter = password.substr(f, 1);
  81. if (letter == numer.substr(e, 1))
  82. {
  83. aNumCount += 1;
  84. }
  85. }
  86. }
  87.  
  88. if (aUpCount > 0)
  89. {
  90. aUpVer += 1;
  91. }
  92.  
  93. if (aLowCount > 0)
  94. {
  95. aLowVer += 1;
  96. }
  97.  
  98. if (aNumCount > 0)
  99. {
  100. aNumVer += 1;
  101. }
  102.  
  103. if ((aUpVer != 1) || (aLowVer != 1) || (aNumVer != 1))
  104. {
  105. cout<<"DI PWEDE PASSWORD MO PAPS KASI: "<<endl;
  106. if (aUpVer != 1)
  107. {
  108. cout<<"LAGYAN MO NAMAN NG CAPITALIZED LETTERS WEW"<<endl;
  109. }
  110. if (aLowVer != 1)
  111. {
  112. cout<<"LAGYAN MO NAMAN NG LOWERCASE NA LETTERS LOL"<<endl;
  113. }
  114. if (aNumVer != 1)
  115. {
  116. cout<<"LAGYAN MO NAMAN NG DIGITS YAN ;)"<<endl;
  117. }
  118. password.clear();
  119. system("pause");
  120. system("cls");
  121. continue;
  122. }
  123. cout<<endl<<"Oks na 'yung gawa mo pero pa-verify muna. tenx";
  124. system("pause");
  125. system("cls");
  126. goto verification;
  127. }
  128.  
  129. verification:
  130. cout<<"I-VERIFY MO SIS LAST NA TALAGA"<<endl;
  131. while(check3 != 0)
  132. {
  133. cout<<"VERIFICATION: \n";
  134. cout<<"Username :";
  135. getline(cin, userConfirmation);
  136. system("cls");
  137. cout<<"VERIFICATION: \n";
  138. cout<<"Username: "<<userConfirmation<<endl;
  139. cout<<"Password: ";
  140. while (check2 != 0)
  141. {
  142. for ( ; ; )
  143. {
  144. passwordConfTemp = getch();
  145. if (passwordConfTemp == '\r')
  146. {
  147. break;
  148. }
  149. passwordConfirmation += passwordConfTemp;
  150. cout<<"*";
  151. }
  152. cout<<endl<<passwordConfirmation<<"<<FOR TESTING"<< endl;
  153. break;
  154. }
  155. if (userConfirmation != user)
  156. {
  157. userVer += 1;
  158. }
  159. if (passwordConfirmation != password)
  160. {
  161. passwordVer += 1;
  162. }
  163. if ((userVer > 0) || (passwordVer > 0))
  164. {
  165. cout<<"AYUSIN MO NAMAN HOY. ETO MALI MO OH:";
  166. if (userVer > 0)
  167. {
  168. cout<<endl<<"SIS MALI NAMAN USERNAME E ITAMA MO NAMAN"<<endl;
  169. }
  170. if (passwordVer > 0)
  171. {
  172. cout<<endl<<"PASSWORD MO RIN MALI WEW ANO BA YAN HMP"<<endl;
  173. }
  174. continue;
  175. }
  176. cout<<endl<<"OKS KA NA MENNNN"<<endl;
  177. cout<<"NA-REGISTER NA ACCOUNT MO NAKS"<<endl;
  178. goto end;
  179. }
  180.  
  181. end:
  182. return 0;
  183. }
  184.  
  185.  
  186.  
  187. /**int main()
  188. {
  189. string user, pass, userConf, passConf;
  190. char passTemp;
  191. int n, check = 1;
  192. int alpha = 0;
  193. bool uppCheck, lowCheck, digCheck;
  194. bool oaCheck;
  195.  
  196. Registration:
  197. cout<<"Registration\n\n";
  198. cout<<"Username: ";
  199. cin>>user;
  200. system ("cls");
  201. cout<<"Registration\n\n";
  202. cout<<"Username: "<<user<<endl;
  203. cout<<"Password: ";
  204. while (check != 0)
  205. {
  206. for (int i=0; ; )
  207. {
  208. passTemp = getch();
  209. if (passTemp == '\r')
  210. {
  211. break;
  212. }
  213. pass += passTemp;
  214. cout<<'*';
  215. }
  216. cout<<endl<<pass;
  217. break;
  218. }
  219. n = pass.length();
  220. cout<<endl<<n;
  221. char val[n+1];
  222. strcpy(val, pass.c_str());
  223. if (n < 6 || n > 10)
  224. {
  225. cout<<"Please input a password with 6-10 characters.";
  226. }
  227. else {
  228. for (int h; h <= 2; h++)
  229. {
  230. if (isalpha(val[h]) != 0)
  231. {
  232. alpha += 1;
  233. }
  234. }
  235.  
  236. if (alpha == 2)
  237. {
  238. for (int i = 0; i <= n ; i++)
  239. {
  240. if ((isupper(val[i])) != 0)
  241. {
  242. uppCheck = true;
  243. break;
  244. }
  245. else {
  246. uppCheck = false;
  247. }
  248. }
  249. }
  250.  
  251. for (int j = 0; j <= n; j++)
  252. {
  253. if ((islower(val[j])) != 0)
  254. {
  255. lowCheck = true;
  256. break;
  257. }
  258. else {
  259. lowCheck = false;
  260. }
  261. }
  262. for (int k = 0; k <= n; k++)
  263. {
  264. if ((isdigit(val[k])) != 0)
  265. {
  266. digCheck = true;
  267. break;
  268. }
  269. else {
  270. digCheck = false;
  271. }
  272. }
  273. }
  274. if ((lowCheck == true ) && (uppCheck == true) && (digCheck == true))
  275. {
  276. cout<<"Your account was successfully created.";
  277. }
  278. else {
  279. cout<<"\nYour password: \n";
  280. if (lowCheck == false)
  281. {
  282. cout<<"\n- must have at least one lowercase letter\n";
  283. oaCheck = false;
  284. }
  285. if (uppCheck == false)
  286. {
  287. cout<<"\n- must have at least one uppercase letter\n";
  288. if (oaCheck != false)
  289. {
  290. oaCheck = false;
  291. }
  292. }
  293. if (digCheck == false)
  294. {
  295. cout<<"\n- must have at least one numerical character\n";
  296. if (oaCheck != false)
  297. {
  298. oaCheck = false;
  299. }
  300. }
  301. }
  302. if (oaCheck = false)
  303. {
  304. system ("pause");
  305. system ("cls");
  306. goto Registration;
  307. }
  308.  
  309. system ("pause");
  310. system ("cls");
  311. cout<<"Registration\n\n";
  312. cout<<"Username: ";
  313. cin>>userConf;
  314. system ("cls");
  315. cout<<"Registration\n\n";
  316. cout<<"Username: "<<userConf<<endl;
  317. cout<<"Password: ";
  318. while (check != 0)
  319. {
  320. for (int l=0; ; )
  321. {
  322. passTemp = getch();
  323. if (passTemp == '\r')
  324. {
  325. break;
  326. }
  327. passConf += passTemp;
  328. cout<<'*';
  329. }
  330. cout<<endl<<passConf;
  331. break;
  332. }
  333.  
  334. if (pass == passConf)
  335. {
  336. cout<<"You have successfully confirmed your account.";
  337. }
  338. else {
  339. cout<<"Incorrect. Please confirm your password again.";
  340. }
  341. return 0;
  342. }
  343. **/
Advertisement
Add Comment
Please, Sign In to add comment