How To Make Login / Signup Program In C++

Application Of File Handling In C++ (Login /Signup Form)


This Program Helps You To Understand The Concepts Of Basic File Handling in C++...

To Make Program More Realistic....We can use this Code to Setup Basic Signup / Login Form...

Header File Used :- <iostream>                    IDE used :-  Dev Cpp
                                <fstream>
                               <string.h>
                               <stdio.h>
                               <conio.h>

Here is link To Get Zip File Of This Program 

https://drive.google.com/file/d/0Bx74JZ-__P1qTWZIM3lqRjdYUjA/view?usp=sharing

                                                  Source Code

#include <iostream>
#include<fstream>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#define max 70

using namespace std;
struct USER
{
char name[30];
char pass[30];
char npass[max];
};
int main(int argc, char** argv) {
fstream fin,fout;
USER U,U_l,U_c;
               fout.open("us.dat",ios::out);
              cout<<"Name :-";
              gets(U.name);
              cout<<"Pass :-";
              gets(U.pass);
              strcpy(U.npass,U.name);
  strcat(U.npass,U.pass);
              fout<<U.npass;
                  fout.close();      
getch();
system("cls");
a:;
  cout<<"Enter Name :-";
  gets(U_l.name);
  cout<<"\nEnter Password :-";
  gets(U_l.pass);
  strcpy(U_l.npass,U_l.name);
  strcat(U_l.npass,U_l.pass);
 fin.open("us.dat",ios::in|ios::binary);
  if(!fin){cout<<"Not found ";
 }
 else{
 while(!fin.eof()){
     fin.getline(U_c.npass,max);
   if(strcmp(U_c.npass,U_l.npass)==0)
   {
    cout<<"Login Successful";
}
else
{
cout<<"Login Failed";
goto a;
}
 
 }
 fin.close();
 }




getch();
return 0;
}




Comments

Popular Posts