Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 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. if(strlen(r[i].pnum) == 10){
  38. a=1;
  39. }else{
  40. while(a == 0){
  41. printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
  42. scanf("%s", r[i].pnum);
  43. if(strlen(r[i].pnum) == 10){
  44. a=1;
  45. }
  46. }
  47. }
  48. // while(strlen(r[i].pnum) != 10)
  49. // {
  50. // printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
  51. // scanf("%s", r[i].pnum);
  52. // }
  53. int k, g, m = 0;
  54. printf("Email: ");
  55. scanf("%s", r[i].mail);
  56. for(k = 0; k <= 1; k--)
  57. {
  58. for(j = 0; j <= strlen(r[i].mail); j++)
  59. {
  60. if(r[i].mail[j] == '@')
  61. {
  62. for(g = 0; g <= strlen(r[i].mail); g++)
  63. {
  64. if(r[i].mail[g] == '.')
  65. {
  66. m = 1;
  67. g = strlen(r[i].mail)+1;
  68. k = 5;
  69. }
  70. }
  71. }
  72. }
  73. if(m == 0)
  74. {
  75. printf("[ERROR] You must contain character both of @ and .\n [Re-type] Email: ");
  76. scanf("%s", r[i].mail);
  77. }
  78. }
  79. printf("Password: ");
  80. scanf("%s", r[i].pass1);
  81. while(strlen(r[i].pass1) != 8)
  82. {
  83. printf("[ERROR] You must use at least 8 characters for password\n [Re-type] Password: ");
  84. scanf("%s", r[i].pass1);
  85. }
  86. printf("Confirmed Password: ");
  87. scanf("%s", r[i].pass2);
  88. for(j = 0; j <= 7; j++)
  89. {
  90. if((r[i].pass2[j] != r[i].pass1[j]))
  91. {
  92. printf("[ERROR] These passwords don't match\n [Re-type] Confirmed Password: ");
  93. scanf("%s", r[i].pass2);
  94. }
  95.  
  96. }
  97. printf("\n-- End of the Registration Process --\n");
  98. printf("Congratulation!! %s,\n", r[i].name);
  99. i++;
  100. printf("Now you can login to the ICT Contact Management System and start to\n search for ICT faculty staffs' and friends' information.\n");
  101. }
  102. int main()
  103. {
  104. registor();
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement