DISCUSSION POINT
https://web.facebook.com/groups/121688281538346/
#include <iostream>
#include <fstream>
using namespace std;
// this func will generate key bases on length of each line in file
int get_key(string a_lines)
{ int key = 0;
key += a_lines.length();
return key; }
// this func will find that file has key or not
bool findkey(string a_lines)
{ int ans = a_lines.find("%");
if(ans >= 0)
{ return 1; }
else
{ return 0; } }
bool readkey(string a_lines)
{
}
main()
{ ifstream infile; // input file handler
ofstream outfile;
char fileName[100]; // name of file to open
string line; // character array for each line in text file
string lines; // character array for full text file
int option;
cout << "Enter the name of text file in current directory:";
cin >> fileName;
infile.open(fileName, ios::in); // opening file in input mode
bool jump = true;
bool ans;
if(!infile)
{ cout << "file not found"; }
else
{ while(!infile.eof())
{ getline(infile, line);
lines += line; }
infile.close();
do
{ cout << "\nOperations on text file";
cout << "\n1.Protect my text file";
cout << "\n2.check security of my text file";
cout << "\n1.Enter your choice (1/2)";
cin >> option;
switch(option)
{ case 1:
if(findkey(lines))
{ cout << "already protected";
cout << " and return " << findkey(lines);
infile.close();
jump = false;
break; }
else
{ outfile.open(fileName, ios::app);
outfile << "%";
outfile << get_key(lines);
cout << "key added";
cout << "and return " << findkey(lines);
jump = false;
outfile.close();
break; }
case 2:
if(findkey(lines))
{ cout << "file is protected using option 2";
cout << "and return " << findkey(lines);
jump = false;
break; }
else
{ cout << "file is not protected please protect file";
cout << "and return " << findkey(lines); } } }
while(jump == true); } }
//
https://web.facebook.com/groups/121688281538346/
#include <iostream>
#include <fstream>
using namespace std;
// this func will generate key bases on length of each line in file
int get_key(string a_lines)
{ int key = 0;
key += a_lines.length();
return key; }
// this func will find that file has key or not
bool findkey(string a_lines)
{ int ans = a_lines.find("%");
if(ans >= 0)
{ return 1; }
else
{ return 0; } }
bool readkey(string a_lines)
{
}
main()
{ ifstream infile; // input file handler
ofstream outfile;
char fileName[100]; // name of file to open
string line; // character array for each line in text file
string lines; // character array for full text file
int option;
cout << "Enter the name of text file in current directory:";
cin >> fileName;
infile.open(fileName, ios::in); // opening file in input mode
bool jump = true;
bool ans;
if(!infile)
{ cout << "file not found"; }
else
{ while(!infile.eof())
{ getline(infile, line);
lines += line; }
infile.close();
do
{ cout << "\nOperations on text file";
cout << "\n1.Protect my text file";
cout << "\n2.check security of my text file";
cout << "\n1.Enter your choice (1/2)";
cin >> option;
switch(option)
{ case 1:
if(findkey(lines))
{ cout << "already protected";
cout << " and return " << findkey(lines);
infile.close();
jump = false;
break; }
else
{ outfile.open(fileName, ios::app);
outfile << "%";
outfile << get_key(lines);
cout << "key added";
cout << "and return " << findkey(lines);
jump = false;
outfile.close();
break; }
case 2:
if(findkey(lines))
{ cout << "file is protected using option 2";
cout << "and return " << findkey(lines);
jump = false;
break; }
else
{ cout << "file is not protected please protect file";
cout << "and return " << findkey(lines); } } }
while(jump == true); } }
//
No comments:
Post a Comment
thanx for visiting vupastpapersmegacollection.blogspot.com/