Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include <string.h>
- int i = 0;
- void registor()
- {
- struct regis
- {
- char id[10], name[20], sur[20], pnum[20], mail[100], pass1[10], pass2[10];
- };
- struct regis r[50];
- int j = 0;
- int a = 0;
- printf(" [Registration] \n");
- printf("Please enter the following information \n");
- printf("ID: ");
- scanf("%s", r[i].id);
- while(strlen(r[i].id) != 7)
- {
- printf("[ERROR] You can use only 7 digits for ID\n [Re-type] ID: ");
- scanf("%s", r[i].id);
- }
- /*for(j = 0; j <= strlen(r[i].id); j++)
- {
- if(check to not have alphabet)
- {
- printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
- scanf("%s", r[i].pnum);
- }
- }*/
- printf("First Name: ");
- scanf("%s", r[i].name);
- printf("Last Name: ");
- scanf("%s", r[i].sur);
- printf("Phone Number: ");
- scanf("%s", r[i].pnum);
- if(strlen(r[i].pnum) == 10){
- a=1;
- }else{
- while(a == 0){
- printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
- scanf("%s", r[i].pnum);
- if(strlen(r[i].pnum) == 10){
- a=1;
- }
- }
- }
- // while(strlen(r[i].pnum) != 10)
- // {
- // printf("[ERROR] You must use only 10 digit numbers for phone number\n [Re-type] Phone Number: ");
- // scanf("%s", r[i].pnum);
- // }
- int k, g, m = 0;
- printf("Email: ");
- scanf("%s", r[i].mail);
- for(k = 0; k <= 1; k--)
- {
- for(j = 0; j <= strlen(r[i].mail); j++)
- {
- if(r[i].mail[j] == '@')
- {
- for(g = 0; g <= strlen(r[i].mail); g++)
- {
- if(r[i].mail[g] == '.')
- {
- m = 1;
- g = strlen(r[i].mail)+1;
- k = 5;
- }
- }
- }
- }
- if(m == 0)
- {
- printf("[ERROR] You must contain character both of @ and .\n [Re-type] Email: ");
- scanf("%s", r[i].mail);
- }
- }
- printf("Password: ");
- scanf("%s", r[i].pass1);
- while(strlen(r[i].pass1) != 8)
- {
- printf("[ERROR] You must use at least 8 characters for password\n [Re-type] Password: ");
- scanf("%s", r[i].pass1);
- }
- printf("Confirmed Password: ");
- scanf("%s", r[i].pass2);
- for(j = 0; j <= 7; j++)
- {
- if((r[i].pass2[j] != r[i].pass1[j]))
- {
- printf("[ERROR] These passwords don't match\n [Re-type] Confirmed Password: ");
- scanf("%s", r[i].pass2);
- }
- }
- printf("\n-- End of the Registration Process --\n");
- printf("Congratulation!! %s,\n", r[i].name);
- i++;
- printf("Now you can login to the ICT Contact Management System and start to\n search for ICT faculty staffs' and friends' information.\n");
- }
- int main()
- {
- registor();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement