SlideShare a Scribd company logo
1 of 9
Download to read offline
#include
#include
int encrypt(void);
int decrypt(void);
int encrypt_view(void);
int decrypt_view(void);
FILE *fp1, *fp2;
char ch;
int main()
{
int choice;
while(1)
{
printf("Select One of the Following: ");
printf(" 1. Encrypt ");
printf("2. Decrypt ");
printf("3. View The Encypted File ");
printf("4. View The Decrypted File ");
printf("5. Exit ");
printf(" Enter Your Choice:t");
scanf("%d", &choice);
switch(choice)
{
case 1: encrypt();
break;
case 2: decrypt();
break;
case 3: encrypt_view();
break;
case 4: decrypt_view();
break;
case 5: exit(1);
}
}
printf(" ");
return 0;
}
int encrypt()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Source","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found ");
}
fp2 = fopen("/home/tusharsoni/Desktop/Target","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found ");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf(" End Of File ");
break;
}
else
{
ch = ch - (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf(" ");
return 0;
}
int decrypt()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Target","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found ");
}
fp2 = fopen("/home/tusharsoni/Desktop/Source","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found ");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf(" End Of File ");
break;
}
else
{
ch = ch + (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf(" ");
return 0;
}
int encrypt_view()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Target","r");
if(fp1 == NULL)
{
printf("No File Found ");
exit(1);
}
else
{
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
break;
}
else
{
printf("%c", ch);
}
}
printf(" ");
fclose(fp1);
}
printf(" ");
return 0;
}
int decrypt_view()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Source","r");
if(fp1 == NULL)
{
printf("No File Found ");
exit(1);
}
else
{
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
break;
}
else
{
printf("%c", ch);
}
}
printf(" ");
fclose(fp1);
}
return 0;
printf(" ");
}
Solution
#include
#include
int encrypt(void);
int decrypt(void);
int encrypt_view(void);
int decrypt_view(void);
FILE *fp1, *fp2;
char ch;
int main()
{
int choice;
while(1)
{
printf("Select One of the Following: ");
printf(" 1. Encrypt ");
printf("2. Decrypt ");
printf("3. View The Encypted File ");
printf("4. View The Decrypted File ");
printf("5. Exit ");
printf(" Enter Your Choice:t");
scanf("%d", &choice);
switch(choice)
{
case 1: encrypt();
break;
case 2: decrypt();
break;
case 3: encrypt_view();
break;
case 4: decrypt_view();
break;
case 5: exit(1);
}
}
printf(" ");
return 0;
}
int encrypt()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Source","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found ");
}
fp2 = fopen("/home/tusharsoni/Desktop/Target","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found ");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf(" End Of File ");
break;
}
else
{
ch = ch - (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf(" ");
return 0;
}
int decrypt()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Target","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found ");
}
fp2 = fopen("/home/tusharsoni/Desktop/Source","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found ");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf(" End Of File ");
break;
}
else
{
ch = ch + (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf(" ");
return 0;
}
int encrypt_view()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Target","r");
if(fp1 == NULL)
{
printf("No File Found ");
exit(1);
}
else
{
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
break;
}
else
{
printf("%c", ch);
}
}
printf(" ");
fclose(fp1);
}
printf(" ");
return 0;
}
int decrypt_view()
{
printf(" ");
fp1 = fopen("/home/tusharsoni/Desktop/Source","r");
if(fp1 == NULL)
{
printf("No File Found ");
exit(1);
}
else
{
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
break;
}
else
{
printf("%c", ch);
}
}
printf(" ");
fclose(fp1);
}
return 0;
printf(" ");
}

More Related Content

Similar to #includestdio.h#includestdlib.hint encrypt(void);int decry.pdf

BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdfBINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
ARYAN20071
 
C code#include stdio.hint main(void) {     FILE infp, o.pdf
C code#include stdio.hint main(void) {     FILE infp, o.pdfC code#include stdio.hint main(void) {     FILE infp, o.pdf
C code#include stdio.hint main(void) {     FILE infp, o.pdf
ankitmobileshop235
 
Using C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdfUsing C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdf
smitaguptabootique
 
Shell to be modified#include stdlib.h #include unistd.h .pdf
Shell to be modified#include stdlib.h #include unistd.h .pdfShell to be modified#include stdlib.h #include unistd.h .pdf
Shell to be modified#include stdlib.h #include unistd.h .pdf
clarityvision
 

Similar to #includestdio.h#includestdlib.hint encrypt(void);int decry.pdf (20)

Data structures
Data structuresData structures
Data structures
 
Stack using Array
Stack using ArrayStack using Array
Stack using Array
 
Array menu
Array menuArray menu
Array menu
 
Unit5 C
Unit5 C Unit5 C
Unit5 C
 
Short Review of Stack
Short Review of StackShort Review of Stack
Short Review of Stack
 
Vcs26
Vcs26Vcs26
Vcs26
 
slides3_077.ppt
slides3_077.pptslides3_077.ppt
slides3_077.ppt
 
BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdfBINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
BINARY SEARCH TREE OPERATIONS #includestdio.h#includestdlib.pdf
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
Circular queue
Circular queueCircular queue
Circular queue
 
PPS Notes Unit 5.pdf
PPS Notes Unit 5.pdfPPS Notes Unit 5.pdf
PPS Notes Unit 5.pdf
 
Practical_File_Of_Data_Structure.pdf
Practical_File_Of_Data_Structure.pdfPractical_File_Of_Data_Structure.pdf
Practical_File_Of_Data_Structure.pdf
 
6. chapter v
6. chapter v6. chapter v
6. chapter v
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
 
C code#include stdio.hint main(void) {     FILE infp, o.pdf
C code#include stdio.hint main(void) {     FILE infp, o.pdfC code#include stdio.hint main(void) {     FILE infp, o.pdf
C code#include stdio.hint main(void) {     FILE infp, o.pdf
 
WK-12-13-file f classs 12 computer science from kv.
WK-12-13-file f classs 12 computer science from kv.WK-12-13-file f classs 12 computer science from kv.
WK-12-13-file f classs 12 computer science from kv.
 
Using C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdfUsing C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdf
 
Shell to be modified#include stdlib.h #include unistd.h .pdf
Shell to be modified#include stdlib.h #include unistd.h .pdfShell to be modified#include stdlib.h #include unistd.h .pdf
Shell to be modified#include stdlib.h #include unistd.h .pdf
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
7.0 files and c input
7.0 files and c input7.0 files and c input
7.0 files and c input
 

More from nareshsonyericcson

Look at the position of Pb in the periodic table .pdf
                     Look at the position of Pb in the periodic table .pdf                     Look at the position of Pb in the periodic table .pdf
Look at the position of Pb in the periodic table .pdf
nareshsonyericcson
 
The process of sperm competition is defined as ‘the competition with.pdf
The process of sperm competition is defined as ‘the competition with.pdfThe process of sperm competition is defined as ‘the competition with.pdf
The process of sperm competition is defined as ‘the competition with.pdf
nareshsonyericcson
 
TCO is the assessment of all life time costs from owning ertain kind.pdf
TCO is the assessment of all life time costs from owning ertain kind.pdfTCO is the assessment of all life time costs from owning ertain kind.pdf
TCO is the assessment of all life time costs from owning ertain kind.pdf
nareshsonyericcson
 
Reply if you have any doubts.public class Life {    public stati.pdf
Reply if you have any doubts.public class Life {    public stati.pdfReply if you have any doubts.public class Life {    public stati.pdf
Reply if you have any doubts.public class Life {    public stati.pdf
nareshsonyericcson
 
Outear includes the pinna (also called auricle), the ear canal, and .pdf
Outear includes the pinna (also called auricle), the ear canal, and .pdfOutear includes the pinna (also called auricle), the ear canal, and .pdf
Outear includes the pinna (also called auricle), the ear canal, and .pdf
nareshsonyericcson
 

More from nareshsonyericcson (20)

5 steps (make sure to press See full answer)- make observat.pdf
5 steps (make sure to press See full answer)- make observat.pdf5 steps (make sure to press See full answer)- make observat.pdf
5 steps (make sure to press See full answer)- make observat.pdf
 
2cosx=(cosxtanx+sinx)(tanx)taking RHS cosxtanx+sinx)(tanx)= .pdf
2cosx=(cosxtanx+sinx)(tanx)taking RHS  cosxtanx+sinx)(tanx)= .pdf2cosx=(cosxtanx+sinx)(tanx)taking RHS  cosxtanx+sinx)(tanx)= .pdf
2cosx=(cosxtanx+sinx)(tanx)taking RHS cosxtanx+sinx)(tanx)= .pdf
 
1.5 X 10-8Solution1.5 X 10-8.pdf
1.5 X 10-8Solution1.5 X 10-8.pdf1.5 X 10-8Solution1.5 X 10-8.pdf
1.5 X 10-8Solution1.5 X 10-8.pdf
 
Neuman System Model helps in studying the stressors, find out the de.pdf
  Neuman System Model helps in studying the stressors, find out the de.pdf  Neuman System Model helps in studying the stressors, find out the de.pdf
Neuman System Model helps in studying the stressors, find out the de.pdf
 
NaOH will completely react will acetic acid and t.pdf
                     NaOH will completely react will acetic acid and t.pdf                     NaOH will completely react will acetic acid and t.pdf
NaOH will completely react will acetic acid and t.pdf
 
the bonding between the carban and the nitrogen i.pdf
                     the bonding between the carban and the nitrogen i.pdf                     the bonding between the carban and the nitrogen i.pdf
the bonding between the carban and the nitrogen i.pdf
 
The salts are more ionic, more soluble they are i.pdf
                     The salts are more ionic, more soluble they are i.pdf                     The salts are more ionic, more soluble they are i.pdf
The salts are more ionic, more soluble they are i.pdf
 
They can form sulfides, but the metal sulfides th.pdf
                     They can form sulfides, but the metal sulfides th.pdf                     They can form sulfides, but the metal sulfides th.pdf
They can form sulfides, but the metal sulfides th.pdf
 
Look at the position of Pb in the periodic table .pdf
                     Look at the position of Pb in the periodic table .pdf                     Look at the position of Pb in the periodic table .pdf
Look at the position of Pb in the periodic table .pdf
 
Yes. A tree which has a root and nothing else.SolutionYe.pdf
Yes. A tree which has a root and nothing else.SolutionYe.pdfYes. A tree which has a root and nothing else.SolutionYe.pdf
Yes. A tree which has a root and nothing else.SolutionYe.pdf
 
First you will want to convert the molarity of ea.pdf
                     First you will want to convert the molarity of ea.pdf                     First you will want to convert the molarity of ea.pdf
First you will want to convert the molarity of ea.pdf
 
Will be uploaded shortlySolutionWill be uploaded shortly.pdf
Will be uploaded shortlySolutionWill be uploaded shortly.pdfWill be uploaded shortlySolutionWill be uploaded shortly.pdf
Will be uploaded shortlySolutionWill be uploaded shortly.pdf
 
The process of sperm competition is defined as ‘the competition with.pdf
The process of sperm competition is defined as ‘the competition with.pdfThe process of sperm competition is defined as ‘the competition with.pdf
The process of sperm competition is defined as ‘the competition with.pdf
 
The answer isA. Public, PrivateThe public and private community .pdf
The answer isA. Public, PrivateThe public and private community .pdfThe answer isA. Public, PrivateThe public and private community .pdf
The answer isA. Public, PrivateThe public and private community .pdf
 
TCO is the assessment of all life time costs from owning ertain kind.pdf
TCO is the assessment of all life time costs from owning ertain kind.pdfTCO is the assessment of all life time costs from owning ertain kind.pdf
TCO is the assessment of all life time costs from owning ertain kind.pdf
 
ROA = Net Income (2015) [Assets (2014) + Assets (2015)] 2= 220.pdf
ROA = Net Income (2015)  [Assets (2014) + Assets (2015)]  2= 220.pdfROA = Net Income (2015)  [Assets (2014) + Assets (2015)]  2= 220.pdf
ROA = Net Income (2015) [Assets (2014) + Assets (2015)] 2= 220.pdf
 
Reply if you have any doubts.public class Life {    public stati.pdf
Reply if you have any doubts.public class Life {    public stati.pdfReply if you have any doubts.public class Life {    public stati.pdf
Reply if you have any doubts.public class Life {    public stati.pdf
 
pH + pOH = 14 1. 14-12.2= 1.8pOH pOH = -log(kb) Kb = 10^-1.pdf
pH + pOH = 14 1. 14-12.2= 1.8pOH pOH = -log(kb) Kb = 10^-1.pdfpH + pOH = 14 1. 14-12.2= 1.8pOH pOH = -log(kb) Kb = 10^-1.pdf
pH + pOH = 14 1. 14-12.2= 1.8pOH pOH = -log(kb) Kb = 10^-1.pdf
 
Outear includes the pinna (also called auricle), the ear canal, and .pdf
Outear includes the pinna (also called auricle), the ear canal, and .pdfOutear includes the pinna (also called auricle), the ear canal, and .pdf
Outear includes the pinna (also called auricle), the ear canal, and .pdf
 
Lewis base is a donor of an electron pair (i.e., lone pair of ele.pdf
Lewis base is a donor of an electron pair (i.e., lone pair of ele.pdfLewis base is a donor of an electron pair (i.e., lone pair of ele.pdf
Lewis base is a donor of an electron pair (i.e., lone pair of ele.pdf
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 

#includestdio.h#includestdlib.hint encrypt(void);int decry.pdf

  • 1. #include #include int encrypt(void); int decrypt(void); int encrypt_view(void); int decrypt_view(void); FILE *fp1, *fp2; char ch; int main() { int choice; while(1) { printf("Select One of the Following: "); printf(" 1. Encrypt "); printf("2. Decrypt "); printf("3. View The Encypted File "); printf("4. View The Decrypted File "); printf("5. Exit "); printf(" Enter Your Choice:t"); scanf("%d", &choice); switch(choice) { case 1: encrypt(); break; case 2: decrypt(); break; case 3: encrypt_view(); break; case 4: decrypt_view(); break; case 5: exit(1); } } printf(" ");
  • 2. return 0; } int encrypt() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Source","r"); if(fp1 == NULL) { printf("Source File Could Not Be Found "); } fp2 = fopen("/home/tusharsoni/Desktop/Target","w"); if(fp2 == NULL) { printf("Target File Could Not Be Found "); } while(1) { ch = fgetc(fp1); if(ch == EOF) { printf(" End Of File "); break; } else { ch = ch - (8 * 5 - 3); fputc(ch, fp2); } } fclose(fp1); fclose(fp2); printf(" "); return 0; } int decrypt() {
  • 3. printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Target","r"); if(fp1 == NULL) { printf("Source File Could Not Be Found "); } fp2 = fopen("/home/tusharsoni/Desktop/Source","w"); if(fp2 == NULL) { printf("Target File Could Not Be Found "); } while(1) { ch = fgetc(fp1); if(ch == EOF) { printf(" End Of File "); break; } else { ch = ch + (8 * 5 - 3); fputc(ch, fp2); } } fclose(fp1); fclose(fp2); printf(" "); return 0; } int encrypt_view() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Target","r"); if(fp1 == NULL) {
  • 4. printf("No File Found "); exit(1); } else { while(1) { ch = fgetc(fp1); if(ch == EOF) { break; } else { printf("%c", ch); } } printf(" "); fclose(fp1); } printf(" "); return 0; } int decrypt_view() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Source","r"); if(fp1 == NULL) { printf("No File Found "); exit(1); } else { while(1) {
  • 5. ch = fgetc(fp1); if(ch == EOF) { break; } else { printf("%c", ch); } } printf(" "); fclose(fp1); } return 0; printf(" "); } Solution #include #include int encrypt(void); int decrypt(void); int encrypt_view(void); int decrypt_view(void); FILE *fp1, *fp2; char ch; int main() { int choice; while(1) { printf("Select One of the Following: "); printf(" 1. Encrypt "); printf("2. Decrypt "); printf("3. View The Encypted File ");
  • 6. printf("4. View The Decrypted File "); printf("5. Exit "); printf(" Enter Your Choice:t"); scanf("%d", &choice); switch(choice) { case 1: encrypt(); break; case 2: decrypt(); break; case 3: encrypt_view(); break; case 4: decrypt_view(); break; case 5: exit(1); } } printf(" "); return 0; } int encrypt() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Source","r"); if(fp1 == NULL) { printf("Source File Could Not Be Found "); } fp2 = fopen("/home/tusharsoni/Desktop/Target","w"); if(fp2 == NULL) { printf("Target File Could Not Be Found "); } while(1) { ch = fgetc(fp1);
  • 7. if(ch == EOF) { printf(" End Of File "); break; } else { ch = ch - (8 * 5 - 3); fputc(ch, fp2); } } fclose(fp1); fclose(fp2); printf(" "); return 0; } int decrypt() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Target","r"); if(fp1 == NULL) { printf("Source File Could Not Be Found "); } fp2 = fopen("/home/tusharsoni/Desktop/Source","w"); if(fp2 == NULL) { printf("Target File Could Not Be Found "); } while(1) { ch = fgetc(fp1); if(ch == EOF) { printf(" End Of File "); break;
  • 8. } else { ch = ch + (8 * 5 - 3); fputc(ch, fp2); } } fclose(fp1); fclose(fp2); printf(" "); return 0; } int encrypt_view() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Target","r"); if(fp1 == NULL) { printf("No File Found "); exit(1); } else { while(1) { ch = fgetc(fp1); if(ch == EOF) { break; } else { printf("%c", ch); } } printf(" ");
  • 9. fclose(fp1); } printf(" "); return 0; } int decrypt_view() { printf(" "); fp1 = fopen("/home/tusharsoni/Desktop/Source","r"); if(fp1 == NULL) { printf("No File Found "); exit(1); } else { while(1) { ch = fgetc(fp1); if(ch == EOF) { break; } else { printf("%c", ch); } } printf(" "); fclose(fp1); } return 0; printf(" "); }