project of password in c 2b 2b with file handling

Solutions on MaxInterview for project of password in c 2b 2b with file handling by the best coders in the world

showing results for - "project of password in c 2b 2b with file handling"
Alan
30 Jan 2020
1#include<bits\stdc++.h> // This Heider file can be ude instead of all oher heiderfiles
2#include<fstream>
3using namespace std;
4void code_function (){
5	
6		int count = 4 ;
7	string pass_store;
8
9	ofstream password;
10
11cout<<"Set a new password :"<<endl;
12password.open("D:\\Password.txt " , ios :: app ); // this is location of your file , and ios :: app will remain the after it excuate mant times 
13getline(cin,pass_store);
14password<<endl<<pass_store;
15	string pass_comp ;
16	
17	do {
18		ifstream password;
19	password>>pass_store;
20	cout<<"Enter Password :";
21	getline(cin,pass_comp);
22	if ( pass_store == pass_comp ){
23		
24		cout<<"Password Entered Successfull "<<endl;
25		break;
26	}
27	else if (pass_store != pass_comp){
28		cout<<"Wrong Password "<<endl;
29		count -=1;
30	
31		cout<<count <<" tries remaning"<<endl;
32	}
33	else 
34	cout<<"invalid Input!"<<endl;
35	
36	} while (count != 0);
37		
38}
39
40int main(){
41	code_function();
42	
43
44return 0;
45}
46// By Muhammad Najaf Shafee from D G khan 
47