Kuwlpranay007
C programming for making the registration form.
- include<stdio.h>
- include<conio.h>
- include<string.h>
struct reg{ long int ph; char em[20],p[8],c[8],n[20],ad[20]; };
int main() { int i,l; char ch; struct reg k; FILE *f1; f1=fopen("registration.txt","w"); do { puts("Name::"); fflush(stdin); scanf("%s",k.n); puts("\nE-mail::"); fflush(stdin); scanf("%s",k.em); puts("\nAddress::"); fflush(stdin); scanf("%s",k.ad); puts("\nPhone number::"); scanf("%ld",&k.ph); puts("\n\npassword(only alphanumeri character)::"); for(i=0;i<8;i++) { ch=getch(); if(ch>='a' && ch<='z' ||ch>='A' && ch<='Z' ||ch>='0' && ch<='9'|| ch==8) { k.p[i]=ch; if(ch==8) { i--; ch=getch(); k.p[i]=ch; continue; } } else { puts("wrong character backspace and continue"); i--; } } k.p[8]='\0'; puts("\n\nConfirm password::"); for(i=0;i<8;i++) { ch=getch(); if(ch>='a' && ch<='z' ||ch>='A' && ch<='Z' ||ch>='0' && ch<='9'|| ch==8) { k.c[i]=ch; if(ch==8) { i--; ch=getch(); k.c[i]=ch; continue; } } else { puts("wrong character backspace and continue"); i--; } } k.c[8]='\0'; if((l=strcmp(k.p,k.c))==1) { puts("\n\npassword matches"); } else { puts("\n\nwon't matches"); } fwrite(&k,sizeof(k),1,f1); printf("\nRecorded !!"); printf("\n\nDo you want to register another (y/n)::"); scanf(" %c",&ch); }while(ch=='y' || ch=='Y'); fclose(f1); getch(); return 0; }