Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include <string.h>
  4. int i = 0;
  5. void registor()
  6. {
  7. struct regis
  8. {
  9. char id[10], name[20], sur[20], pnum[20], mail[100], pass1[10], pass2[10];
  10. };
  11. struct regis r[50];
  12. int j = 0;
  13. int a = 0;
  14. printf(" [Registration] \n");
  15. printf("Please enter the following information \n");
  16. printf("ID: ");
  17. scanf("%s", r[i].id);
  18. while(strlen(r[i].id) != 7)
  19. {
  20. printf("[ERROR] You can use only 7 digits for ID\n [Re-type] ID: ");
  21. scanf("%s", r[i].id);
  22. }
  23. /*for(j = 0; j <= strlen(r[i].id); j++)
  24. {
  25. if(check to not have alphabet)
  26. {
  27. printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
  28. scanf("%s", r[i].pnum);
  29. }
  30. }*/
  31. printf("First Name: ");
  32. scanf("%s", r[i].name);
  33. printf("Last Name: ");
  34. scanf("%s", r[i].sur);
  35. printf("Phone Number: ");
  36. scanf("%s", r[i].pnum);
  37. while(a == 0){
  38. printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
  39. scanf("%s", r[i].pnum);
  40. if(strlen(r[i].pnum) == 10){
  41. a=1;
  42. }
  43. }
  44. // while(strlen(r[i].pnum) != 10)
  45. // {
  46. // printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
  47. // scanf("%s", r[i].pnum);
  48. // }
  49. int k, g, m = 0;
  50. printf("Email: ");
  51. scanf("%s", r[i].mail);
  52. for(k = 0; k <= 1; k--)
  53. {
  54. for(j = 0; j <= strlen(r[i].mail); j++)
  55. {
  56. if(r[i].mail[j] == '@')
  57. {
  58. for(g = 0; g <= strlen(r[i].mail); g++)
  59. {
  60. if(r[i].mail[g] == '.')
  61. {
  62. m = 1;
  63. g = strlen(r[i].mail)+1;
  64. k = 5;
  65. }
  66. }
  67. }
  68. }
  69. if(m == 0)
  70. {
  71. printf("[ERROR] You must contain character both of @ and .\n [Re-type] Email: ");
  72. scanf("%s", r[i].mail);
  73. }
  74. }
  75. printf("Password: ");
  76. scanf("%s", r[i].pass1);
  77. while(strlen(r[i].pass1) != 8)
  78. {
  79. printf("[ERROR] You must use at least 8 characters for password\n [Re-type] Password: ");
  80. scanf("%s", r[i].pass1);
  81. }
  82. printf("Confirmed Password: ");
  83. scanf("%s", r[i].pass2);
  84. for(j = 0; j <= 7; j++)
  85. {
  86. if((r[i].pass2[j] != r[i].pass1[j]))
  87. {
  88. printf("[ERROR] These passwords don't match\n [Re-type] Confirmed Password: ");
  89. scanf("%s", r[i].pass2);
  90. }
  91.  
  92. }
  93. printf("\n-- End of the Registration Process --\n");
  94. printf("Congratulation!! %s,\n", r[i].name);
  95. i++;
  96. printf("Now you can login to the ICT Contact Management System and start to\n search for ICT faculty staffs' and friends' information.\n");
  97. }
  98. int main()
  99. {
  100. registor();
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement