By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,082 Members | 2,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,082 IT Pros & Developers. It's quick & easy.

please help me correct the errors in this program.have to submit theproject tomorrow!!

P: n/a

#include<fstream.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<ctype.h>
#include<stdio.h>
void setup()
void help();
void main(int argc, char *argv[])
char color[80];
ifstream clrs;
clrs.open("graph.dsp");
if(!clrs)
{
cout<<"Important data file missing,will terminate";
getch();
exit(1);
}
for( int col=1;col<=11;col++)
{
clrs.getline(color,80);
textcolor(col);
for(int no=0;no<strlen(color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}

clrs.close();
textcolor(seven);
cprintf("");
cout<<"EnDe(encryptor-decryptor) version 3.0 for MS-DOS\n";
cout<<"<c2001 -R.G INFOTECH Ltd-project release";
unsigned long enc=5;
if(argc!=4&&argc!=2)
{
help:
cout<<"\n Encryptor-Decryptor useage help:\n";
cout<<"syntax:\n";
cout<<"\tEnDe <option<source path and file<target path and
file>";
cout<<"\n\nOptions:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file after Decryption\n";
exit(0);
}
*argv[1]=tolower(*argv[1]);
if(argc==2)
{
if(!strcmp(argv[1],"setup")||!strcmp(argv[1],"setup")
||!strcmp(argv[1],"SETUP"))
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open("pass.end");
if(!setup_pass)
{
ofstream ofile;
ofile.open("pass.end");
ofile<<"OE";
ofile.close();
ofile.open("ende.log",ios::trunc);
ofile.close();
setup_pass.open("pass.end");
}
setup_pass.get(checkpass);
setup_pass.getline(set_check,8);
setup_pass.close();
setup_pass.open("pass.end");
setup_pass.getline(setcheck,8);
setup_pass.close();
p_set=getpass("enter your setup password: ");
int passlen=strlen(p_set);
length=atoi(setcheck);

if(passlen==length)
{
for(int pc=0;pc<=passlen;pc++)
set_check[pc]=set_check[pc]-69;
if(!strcmp(p_set,set_check))
setup();
else
cout<<"incorrect password";
exit(0);
}
else
if(passlen!=length)
{
cout<<"incorrect password";
exit(0);
}
}
}
if(*argv[1]!='e'&&argv[1]!='d'&&*argv[1]!='s'&&*argv[1]+'t')
{
help();
}
char line,logout;
char *passw;
char *passc;
char pass1[8],pass2[8];
long =-1;
double size=1.0;
double per=1.0;
char ch;
int flag=0;
float fin;
int fin_i;
ifstream check;
ifstream ifile;
ifstream inlog;
ofstream pas;
ofstream ofile;
ofstream logfile;
logfile.open("temp.log");
ifile.open(argv[2]);
if(!ifile)
{
cout<<"Error opening Source File,will terminate";
exit(0);
}
check.open(argv[2],ios::in);
ofile.open(argv[3],ios::nonreplace);
if (!ofile)
{
cout<<"Error opening Target File,will terminate";
exit(0);
}
while(check)
{
check.get(h);
size++;
}
check.close();
if(*argv[1]=='e')
{
cout<<"Mode: Encryption\n";
error_e;
passw=getpass("Enter Password: ");
pas.open("temp.pas");
pas<<passw<<"\n";
passc=getpass("Verify Password: ");
pas<<passc;
pas.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2));
{
logfile<<"\n\nEncrypted "argv[2]<<"to"<<argv[3];
logfile<<"\nwith password"<<passw;
logfile.close();
logfile.open("ende.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eof())
{
ifile.get(line);
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete ";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}

cout<<"\r"<<"File Encrypted";
ifile.close();
ofile.close();
}
else
if(pass2!=pass1)
{
cout<<"Password Mismatch, Re Enter Password\n";
goto error_e;
}
}
if(*argv[1]=='s')
{
cout<<"Mode: Deletion of Soyrce Fleafter Encryption\n";
error_s:
passw=getpass("Enter Password: ");
pas.open("temp.pas");
pas<<passw<<"\n";
passc=getpass("Verify Password: ");
pas<<passc;
pas.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2))
{
logfile<<"Encrypted"<<argv[2]<<" to"<<argv[3];
logfile<<"\nwith password"<<pasw;
logfile.close();
logfile.open("ende.log",ios::app);
inlog.open("temp.log");

while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system<"del temp.log");
i=strlen(passw);
for(long k=0;k,=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eof())
{
ifile.get(line);
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"file Encrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,"del ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
else
if(flag!=0)
{
cout<<"Password Mismatch,Re Enter password\n";
goto error_s;
}
}
else
if(*argv[1]=='d')
{
cout<<"Mode:Decryption \n";
char *passw;
passw=getpass("Enter Password:m ");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
logfile<<"\n\nDecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close();
logfile.open("EnDe.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
while(!file.eof())
{
ifile.get(line);
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"File decrypted";
ifile.close();
ofile.close();
}
if(*argv[1]=='t')
{
cout<<"Mode:deletion of encrypted file after decryption\n";
passw=getpass("enter password: ");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"password incorrect";
exit(0);
}
}
logfile<<"\n\nDecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close();
logfile.open("EnDe.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
while(!ifile.eof());
{
ifile.get(line);
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"file Decrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,{:"del ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
}
//menu.cpp
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<process.h>
void view();
void log();
void set_chan();
void file();
void help();
void about();
void pass();
void setup();
{
int flag=0;
int time;
one:
flag=0;
textcolor(15);
textbackground(0);
clrscr();
union regs in,out;
cout<<"\n\n\n\n\n\n\t\t\tEnDe setup\n";
textcolor(0);
textbackground(15);
cout<<"\t\t\t";
cprintf("1.View Logfile");
cout<<"\n\t\t\t2.Clear logfile");
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help On Using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swone:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto seven;
case 28:
textbackground(0);
textcolor(15);
clrscr();
view();
getch();
goto one;
case 80:
goto two;
default:
goto swone;
}
}
else
{
textbackground(0);textcolor(7);
pass();
}
two:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View logfile";
cout<<"\n\t\t\t";
cprintf("2.Clear LogFile");
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swtwo:
for(time=0;time<3000:time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case 72:
goto one;
case 28:
textbackground(0);
textcolor(15);
clrscr();
log();
goto one;
case 80:
goto three;
default:
goto swtwo;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
three;
falg=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t";
cprintf("3.Change Setup Password");
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swthree:
for(time=0;time<3000;time++)
{
delay(10);

if(kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,out);
switch(out.h.ah)
{

case 72:
goto two;
case 28:
textbackground(0);
textcolor(15);
clrscr();
set_chan();
goto one;
case 80:
goto four;
default:
goto swthree;
}
}
else
{
textcolor(7)
textbackground(0)
pass();
}
four:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t";
cprintf("4.Change Encrypted File's Password");
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swfour:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto three;
case 28:
textbackground(0);
textcolor(15);
clrscr();
file();
goto one;
case 80:
goto five;
default;
goto swfour;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
five:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t";
cprintf("5.Help on using EnDe");
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swfive:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto four;
case 28:
textbackground(0);
textcolor(15);
clrscr();
help();
getch();
goto one;
case 80:
goto six;
default:
goto swfive;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
six:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t";
cprintf("6.About");
cout<<"\n\t\t\t7.Quit";
swsix:

for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto five;
case 28:
textbackground(0);
textcolor(15);
clrscr();
about();
getch();
goto one;
case 80:
goto seven;
default:
goto swsix;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
seven:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"3.Change Setup password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t";
cprintf("7.Quit");
swseven:
for(time=0;time<3000;time++)
{
delay(10);
if (kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
soto six;
case 28:
tetbackground(0);
textcolor(15);
clrscr();
exit(0);
getch();
goto one;
case 80:
goto one;
default:
goto swseven;
}
}
else{
textcolor(7);
textbackground(0);
pass();
}
}

}
#include<fstream.h>
#include<conio.h>
void view()
{
clrscr();
ifstream ifile;
char line;
while(ifile)
{
ifile.open("ende.log");
line=line-500;
cout<<line;
}
}
#include<fstream.h>
#include<conio.h>
#include<dos.h>
void log()
{
cout<<"Are you sure you want to clear the log fike?(y/n)";
char ch;
cin>>ch;
if(ch=='y'||ch=='Y')
{
ofstream clear;
clear.open("ende.log",ios::trunc);
clear.close();
cout<<"Log file clearde";
getch();
}
}
#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
void file()
{
int=-1;
ifstream ifile;
char *fname;
char line;
char *passw,*passc;
char pass[8],pass2[8];
cout<<"Enter the name and path of the file:";
cout<<"\nNote:TO the password of a file you must be in the
directory holding the file";
cout<<"\nEnDe:\>";
gets(fname);
ifile.open(fname);
if(!ifile)
{
cout<<"Could not open file";
exit(1);
}
passw=getpass("Enter current Password:");
i=strlen(passw);
for(ini k=0;k<=1;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
ofstream ofile;
ifstream check;
ofile.open("temp.pad");
passw=getpass("Enter new password:");
ofile<<passw<<"\n";
passc=getpass("Verify Password");
ofile<<passc;
ofile.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2))
{
ofile.open("temp.tem");
i=strlen(pass1);
for(k=0;k<=i;k++)
{
pass1[k]=pass1[k]+500;
ofile<<pass1[k];
}
while(!ifile.eof())
{
ifile.get(line);
ofile<<line;
}
cout<<"Password changed successfully";
}

char source[50]="",dest[50]="";
strcat(source,"del ");
strcat(source,fname);
strcat(dest,"ren");
strcat(dest,"temp.tem");
ofile.close();
ifile.close();
strcat(dest,fname);
system(source);
system(dest);
}

#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void set_chan()
{
ofstream setup;
ifstream check;
char *pass,*passc;
char pass1[8],pass2[8];
setup.open("temp.pas");
pass=getpass("New Password:");
int passlen=strlen(pass);
setup<<pass<<"\n";
passc=getpass<"Verify Password:");
setup<<pasc;
setup.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
setup.open(:"pass.end");
if(!strcmp(pass1,pass2))
{
setup<<passlen;
for(int i=0;i<=passlen;i++)
{
pass1[i]=pass1[i]+69;
setup<<pass1[i];
}
cout<<"The password has been changed successfully";

}
else
cout<<"The Passwords do not match";
getch();
setup.close();
}
#include<iostream.h>
#include<conio.h>
void help()
{
clrscr();
cout<"\nEncryptor-Decryptor ver 3.0 usage help:\n";
cout<<"Syntax:\n";
cout<<"\tEnDe<option><source path and file><target path and file>
\n";
cout<<"\n\nOptions:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file afte decryptionn\n";
cout<<"\n\nOr when in EnDe Setup mode,there are five options:\n";
cout<<"1.Clear log File:\n";
cout<<"\tLog File is a file which keeps the history of all the
operations\n";
cout<<"\tcarried out through EnDe,in an encrypted format\n";
cout<<"\t This fynction clears the log file so no one can retrieve
the password\n";
cout<<"\tof any of your encrypted files if he knows your setup
password\n";
cout<<"\n\n\n\n||more||";
getch();
clrscr();
cout<<"2.Change the setup password:\n";
cout<<"\tThis function changes the setup password through which you
can\n";
cout<<"\tagain access to the Setup Menu\n";
cout<<"3.Change the password of an encrypted file:\n";
cout<<"\tThis function changes the password of an already encrypted
file\n";
cout<<"\n4.Help\n";
cout<<"\nabout:\n";
cout<<"\tGives version information and the names of the developers(s)
\n";
cout<<"\n6.Quit:\n";
cout<<"\tQuit EnDe Setup Menu\n";
}
#include<iostream.h>
#include<conio.h>
void about()
{
clrscr();
cout<<"(Encryptor-Decryptor)version3.0 for MS-DOS\n";
cout<<"<c>2001- R.G.Infotech Ltd.-Project Release\n";
}
#include<fstream.h>
#include<stdlib.h>
#include<string.h>
#include<dos.h>
#include<conio.h>
void setup();
void pass()
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open("pass.end");
setup_pass.get(checkpass);
setup_pass.getline(set_check,8);
setup_pass.close();
setup_pass.open("pass.end");
setup_pass.getline(setcheck,8);
setup_pass.close();
clrscr();
char color[80];
ifstream clrs;
clrs.open("graph.dsp");
for(int col=1;col<=11;col++)
{
clrs.getline(color,80);
textcolor(col);
for(int no=0;no<strlen(color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}
clrs.close();
textcolor(10);
int pc;
pcheck:
p_set=getpass("Enter your setup password:");
int passlen=strlen(p_set);
length=atoi(setcheck);
if(passlen==length)
{
for(pc=0;pc<=passlen;pc++)
p_set[pc]=p_set[pc]+69;
if(!strcmp(p_set,set_check))
setup();
else
goto pcheck;
}
else
goto pcheck;
}




Oct 19 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
pr********@gmail.com wrote:
#include<fstream.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<ctype.h>
#include<stdio.h>
void setup()
void help();
void main(int argc, char *argv[])
char color[80];
ifstream clrs;
clrs.open("graph.dsp");
if(!clrs)
{
cout<<"Important data file missing,will terminate";
getch();
exit(1);
}
for( int col=1;col<=11;col++)
{
clrs.getline(color,80);
textcolor(col);
for(int no=0;no<strlen(color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}

clrs.close();
textcolor(seven);
cprintf("");
cout<<"EnDe(encryptor-decryptor) version 3.0 for MS-DOS\n";
cout<<"<c2001 -R.G INFOTECH Ltd-project release";
unsigned long enc=5;
if(argc!=4&&argc!=2)
{
help:
cout<<"\n Encryptor-Decryptor useage help:\n";
cout<<"syntax:\n";
cout<<"\tEnDe <option<source path and file<target path and
file>";
cout<<"\n\nOptions:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file after Decryption\n";
exit(0);
}
*argv[1]=tolower(*argv[1]);
if(argc==2)
{
if(!strcmp(argv[1],"setup")||!strcmp(argv[1],"setup")
||!strcmp(argv[1],"SETUP"))
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open("pass.end");
if(!setup_pass)
{
ofstream ofile;
ofile.open("pass.end");
ofile<<"OE";
ofile.close();
ofile.open("ende.log",ios::trunc);
ofile.close();
setup_pass.open("pass.end");
}
setup_pass.get(checkpass);
setup_pass.getline(set_check,8);
setup_pass.close();
setup_pass.open("pass.end");
setup_pass.getline(setcheck,8);
setup_pass.close();
p_set=getpass("enter your setup password: ");
int passlen=strlen(p_set);
length=atoi(setcheck);

if(passlen==length)
{
for(int pc=0;pc<=passlen;pc++)
set_check[pc]=set_check[pc]-69;
if(!strcmp(p_set,set_check))
setup();
else
cout<<"incorrect password";
exit(0);
}
else
if(passlen!=length)
{
cout<<"incorrect password";
exit(0);
}
}
}
if(*argv[1]!='e'&&argv[1]!='d'&&*argv[1]!='s'&&*argv[1]+'t')
{
help();
}
char line,logout;
char *passw;
char *passc;
char pass1[8],pass2[8];
long =-1;
double size=1.0;
double per=1.0;
char ch;
int flag=0;
float fin;
int fin_i;
ifstream check;
ifstream ifile;
ifstream inlog;
ofstream pas;
ofstream ofile;
ofstream logfile;
logfile.open("temp.log");
ifile.open(argv[2]);
if(!ifile)
{
cout<<"Error opening Source File,will terminate";
exit(0);
}
check.open(argv[2],ios::in);
ofile.open(argv[3],ios::nonreplace);
if (!ofile)
{
cout<<"Error opening Target File,will terminate";
exit(0);
}
while(check)
{
check.get(h);
size++;
}
check.close();
if(*argv[1]=='e')
{
cout<<"Mode: Encryption\n";
error_e;
passw=getpass("Enter Password: ");
pas.open("temp.pas");
pas<<passw<<"\n";
passc=getpass("Verify Password: ");
pas<<passc;
pas.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2));
{
logfile<<"\n\nEncrypted "argv[2]<<"to"<<argv[3];
logfile<<"\nwith password"<<passw;
logfile.close();
logfile.open("ende.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eof())
{
ifile.get(line);
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete ";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}

cout<<"\r"<<"File Encrypted";
ifile.close();
ofile.close();
}
else
if(pass2!=pass1)
{
cout<<"Password Mismatch, Re Enter Password\n";
goto error_e;
}
}
if(*argv[1]=='s')
{
cout<<"Mode: Deletion of Soyrce Fleafter Encryption\n";
error_s:
passw=getpass("Enter Password: ");
pas.open("temp.pas");
pas<<passw<<"\n";
passc=getpass("Verify Password: ");
pas<<passc;
pas.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2))
{
logfile<<"Encrypted"<<argv[2]<<" to"<<argv[3];
logfile<<"\nwith password"<<pasw;
logfile.close();
logfile.open("ende.log",ios::app);
inlog.open("temp.log");

while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system<"del temp.log");
i=strlen(passw);
for(long k=0;k,=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eof())
{
ifile.get(line);
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"file Encrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,"del ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
else
if(flag!=0)
{
cout<<"Password Mismatch,Re Enter password\n";
goto error_s;
}
}
else
if(*argv[1]=='d')
{
cout<<"Mode:Decryption \n";
char *passw;
passw=getpass("Enter Password:m ");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
logfile<<"\n\nDecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close();
logfile.open("EnDe.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
while(!file.eof())
{
ifile.get(line);
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"File decrypted";
ifile.close();
ofile.close();
}
if(*argv[1]=='t')
{
cout<<"Mode:deletion of encrypted file after decryption\n";
passw=getpass("enter password: ");
i=strlen(passw);
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"password incorrect";
exit(0);
}
}
logfile<<"\n\nDecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close();
logfile.open("EnDe.log",ios::app);
inlog.open("temp.log");
while(!inlog.eof())
{
inlog.get(logout);
logout=logout+500;
logfile<<logout;
}
logfile.close();
inlog.close();
system("del temp.log");
while(!ifile.eof());
{
ifile.get(line);
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin_i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"file Decrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,{:"del ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
}
//menu.cpp
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<process.h>
void view();
void log();
void set_chan();
void file();
void help();
void about();
void pass();
void setup();
{
int flag=0;
int time;
one:
flag=0;
textcolor(15);
textbackground(0);
clrscr();
union regs in,out;
cout<<"\n\n\n\n\n\n\t\t\tEnDe setup\n";
textcolor(0);
textbackground(15);
cout<<"\t\t\t";
cprintf("1.View Logfile");
cout<<"\n\t\t\t2.Clear logfile");
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help On Using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swone:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto seven;
case 28:
textbackground(0);
textcolor(15);
clrscr();
view();
getch();
goto one;
case 80:
goto two;
default:
goto swone;
}
}
else
{
textbackground(0);textcolor(7);
pass();
}
two:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View logfile";
cout<<"\n\t\t\t";
cprintf("2.Clear LogFile");
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swtwo:
for(time=0;time<3000:time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case 72:
goto one;
case 28:
textbackground(0);
textcolor(15);
clrscr();
log();
goto one;
case 80:
goto three;
default:
goto swtwo;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
three;
falg=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t";
cprintf("3.Change Setup Password");
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swthree:
for(time=0;time<3000;time++)
{
delay(10);

if(kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,out);
switch(out.h.ah)
{

case 72:
goto two;
case 28:
textbackground(0);
textcolor(15);
clrscr();
set_chan();
goto one;
case 80:
goto four;
default:
goto swthree;
}
}
else
{
textcolor(7)
textbackground(0)
pass();
}
four:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"\n\t\t\t";
cprintf("4.Change Encrypted File's Password");
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swfour:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto three;
case 28:
textbackground(0);
textcolor(15);
clrscr();
file();
goto one;
case 80:
goto five;
default;
goto swfour;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
five:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t";
cprintf("5.Help on using EnDe");
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t7.Quit";
swfive:
for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto four;
case 28:
textbackground(0);
textcolor(15);
clrscr();
help();
getch();
goto one;
case 80:
goto six;
default:
goto swfive;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
six:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"\n\t\t\t3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t5.Help on using EnDe";
cout<<"\n\t\t\t";
cprintf("6.About");
cout<<"\n\t\t\t7.Quit";
swsix:

for(time=0;time<3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
goto five;
case 28:
textbackground(0);
textcolor(15);
clrscr();
about();
getch();
goto one;
case 80:
goto seven;
default:
goto swsix;
}
}
else
{
textcolor(7);
textbackground(0);
pass();
}
seven:
flag=0;
textbackground(0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground(15);
cout<<"\n\t\t\t1.View Logfile";
cout<<"\n\t\t\t2.Clear Logfile";
cout<<"3.Change Setup password";
cout<<"\n\t\t\t4.Change Encrypted File's Password";
cout<<"5.Help on using EnDe";
cout<<"\n\t\t\t6.About";
cout<<"\n\t\t\t";
cprintf("7.Quit");
swseven:
for(time=0;time<3000;time++)
{
delay(10);
if (kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,&out);
switch(out.h.ah)
{
case72:
soto six;
case 28:
tetbackground(0);
textcolor(15);
clrscr();
exit(0);
getch();
goto one;
case 80:
goto one;
default:
goto swseven;
}
}
else{
textcolor(7);
textbackground(0);
pass();
}
}

}
#include<fstream.h>
#include<conio.h>
void view()
{
clrscr();
ifstream ifile;
char line;
while(ifile)
{
ifile.open("ende.log");
line=line-500;
cout<<line;
}
}
#include<fstream.h>
#include<conio.h>
#include<dos.h>
void log()
{
cout<<"Are you sure you want to clear the log fike?(y/n)";
char ch;
cin>>ch;
if(ch=='y'||ch=='Y')
{
ofstream clear;
clear.open("ende.log",ios::trunc);
clear.close();
cout<<"Log file clearde";
getch();
}
}
#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
void file()
{
int=-1;
ifstream ifile;
char *fname;
char line;
char *passw,*passc;
char pass[8],pass2[8];
cout<<"Enter the name and path of the file:";
cout<<"\nNote:TO the password of a file you must be in the
directory holding the file";
cout<<"\nEnDe:\>";
gets(fname);
ifile.open(fname);
if(!ifile)
{
cout<<"Could not open file";
exit(1);
}
passw=getpass("Enter current Password:");
i=strlen(passw);
for(ini k=0;k<=1;k++)
{
passw[k]=passw[k]+500;
ifile.get(line);
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
ofstream ofile;
ifstream check;
ofile.open("temp.pad");
passw=getpass("Enter new password:");
ofile<<passw<<"\n";
passc=getpass("Verify Password");
ofile<<passc;
ofile.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass1,pass2))
{
ofile.open("temp.tem");
i=strlen(pass1);
for(k=0;k<=i;k++)
{
pass1[k]=pass1[k]+500;
ofile<<pass1[k];
}
while(!ifile.eof())
{
ifile.get(line);
ofile<<line;
}
cout<<"Password changed successfully";
}

char source[50]="",dest[50]="";
strcat(source,"del ");
strcat(source,fname);
strcat(dest,"ren");
strcat(dest,"temp.tem");
ofile.close();
ifile.close();
strcat(dest,fname);
system(source);
system(dest);
}

#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void set_chan()
{
ofstream setup;
ifstream check;
char *pass,*passc;
char pass1[8],pass2[8];
setup.open("temp.pas");
pass=getpass("New Password:");
int passlen=strlen(pass);
setup<<pass<<"\n";
passc=getpass<"Verify Password:");
setup<<pasc;
setup.close();
check.open("temp.pas");
check.getline(pass1,8);
check.getline(pass2,8);
check.close();
system("del temp.pas");
setup.open(:"pass.end");
if(!strcmp(pass1,pass2))
{
setup<<passlen;
for(int i=0;i<=passlen;i++)
{
pass1[i]=pass1[i]+69;
setup<<pass1[i];
}
cout<<"The password has been changed successfully";

}
else
cout<<"The Passwords do not match";
getch();
setup.close();
}
#include<iostream.h>
#include<conio.h>
void help()
{
clrscr();
cout<"\nEncryptor-Decryptor ver 3.0 usage help:\n";
cout<<"Syntax:\n";
cout<<"\tEnDe<option><source path and file><target path and file>
\n";
cout<<"\n\nOptions:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file afte decryptionn\n";
cout<<"\n\nOr when in EnDe Setup mode,there are five options:\n";
cout<<"1.Clear log File:\n";
cout<<"\tLog File is a file which keeps the history of all the
operations\n";
cout<<"\tcarried out through EnDe,in an encrypted format\n";
cout<<"\t This fynction clears the log file so no one can retrieve
the password\n";
cout<<"\tof any of your encrypted files if he knows your setup
password\n";
cout<<"\n\n\n\n||more||";
getch();
clrscr();
cout<<"2.Change the setup password:\n";
cout<<"\tThis function changes the setup password through which you
can\n";
cout<<"\tagain access to the Setup Menu\n";
cout<<"3.Change the password of an encrypted file:\n";
cout<<"\tThis function changes the password of an already encrypted
file\n";
cout<<"\n4.Help\n";
cout<<"\nabout:\n";
cout<<"\tGives version information and the names of the developers(s)
\n";
cout<<"\n6.Quit:\n";
cout<<"\tQuit EnDe Setup Menu\n";
}
#include<iostream.h>
#include<conio.h>
void about()
{
clrscr();
cout<<"(Encryptor-Decryptor)version3.0 for MS-DOS\n";
cout<<"<c>2001- R.G.Infotech Ltd.-Project Release\n";
}
#include<fstream.h>
#include<stdlib.h>
#include<string.h>
#include<dos.h>
#include<conio.h>
void setup();
void pass()
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open("pass.end");
setup_pass.get(checkpass);
setup_pass.getline(set_check,8);
setup_pass.close();
setup_pass.open("pass.end");
setup_pass.getline(setcheck,8);
setup_pass.close();
clrscr();
char color[80];
ifstream clrs;
clrs.open("graph.dsp");
for(int col=1;col<=11;col++)
{
clrs.getline(color,80);
textcolor(col);
for(int no=0;no<strlen(color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}
clrs.close();
textcolor(10);
int pc;
pcheck:
p_set=getpass("Enter your setup password:");
int passlen=strlen(p_set);
length=atoi(setcheck);
if(passlen==length)
{
for(pc=0;pc<=passlen;pc++)
p_set[pc]=p_set[pc]+69;
if(!strcmp(p_set,set_check))
setup();
else
goto pcheck;
}
else
goto pcheck;
}



What is this?
What errors does it have?
What is dos.h?
Oct 19 '08 #2

P: n/a
Michael wrote:
pr********@gmail.com wrote:
Awful code
>>
What is this?
What errors does it have?
What is dos.h?
Did you really have to quote all that just to add this?

--
Ian Collins
Oct 19 '08 #3

P: n/a
Do you *really* expect us to do your work for you? You must be
kidding, right?
Oct 19 '08 #4

P: n/a
<pr********@gmail.comwrote:
#include<fstream.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<ctype.h>
#include<stdio.h>
void setup()
void help();
void main(int argc, char *argv[])
char color[80];
<snip>

The first error I note is that
void main(int argc, char *argv[])
should be followed by either a ; or a {.

It has neither of these. A ; would make it a function prototype and a {
would make it a function definition..

How big was the file the last time you made a successful compile? If the
answer is "never did" you have written *far* too much code without
compiling. Also, you do not use enough functions. Functions allow you to
clear your mind of excessive details and focus on one relatively small part
of the problem. My guess is you intend to use three functions for this
program. Visualize a novel written with three paragraphs. Does that sound
like a good idea?

Bottom line, write this off as a learning experience and throw it away.
Start over.

Oops. I looked again and now the first error I see is the lack of a ; after
void setup()
which would make it a function prototype.



Oct 19 '08 #5

P: n/a
On Oct 19, 5:00*pm, "osmium" <r124c4u...@comcast.netwrote:
<priyajo...@gmail.comwrote:
#include<fstream.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<ctype.h>
#include<stdio.h>
void setup()
void help();
void main(int argc, char *argv[])
char color[80];
<snip>
The first error I note is that
* void main(int argc, char *argv[])
should be followed by either a ; or a {.
It has neither of these. *A ; would make it a function
prototype and a { would make it a function definition..
Actually, the first error I encountered was "#include
<fstream.h>". A non-existant header. Followed by similar
errors for <process.h>, <conio.hand <dos.h>.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Oct 19 '08 #6

P: n/a
In article
<69**********************************@s1g2000prg.g ooglegroups.com>,
pr********@gmail.com wrote:
please help me correct the errors in this program.have to submit the
project tomorrow!!
>
#include<fstream.h>
[...]

Job aborted. Payment required before work will be done for you. Suitable
sum=$1,000,000 (ONE MILLION US DOLLARS).
Oct 19 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.