Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to encode and decode given string

Posted By: Easy Tutor     Category: C Programming     Views: 9787

Write a program that encode and decodes user input string.

Code for Program to encode and decode given string in C Programming


#include <stdio.h>
#include <conio.h>
#include <string.h>

void main(){
     charstring[50],tmp[50];
     int spcnt[50],i,j,c;
     clrscr();
     printf("Enter a string : ");
     gets(string);

     //encode logicfor(i=0;string[i];i++){
     string[i]=string[i]+3;
     }
     textcolor(GREEN);
     printf("\n");
     cprintf("Encoded string is as follow : %s",string);

     //decompressed logicfor(i=0;string[i];i++){
     string[i]=string[i]-3;
     }
     textcolor(GREEN);
     printf("\n");
     cprintf("De-Encoded string is as follow : %s",string);
    getch();
}
  
Share: 


Didn't find what you were looking for? Find more on Program to encode and decode given string Or get search suggestion and latest updates.

Easy Tutor
Easy Tutor author of Program to encode and decode given string is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Vinay Vinny from Australia Comment on: Oct 16
How to solve this problem?


You have n doors in a row that are all initially closed. You make n passes by the doors. The first

time through, you visit every door and toggle the door (if the door is closed, you open it; if it is

open, you close it). The second time you only visit every 2nd door (door #2, #4, #6, ...). The

third time, every 3rd door (door #3, #6, #9, ...), etc, until you only visit the nth door.

You need to find out what state are the doors in after the last pass? Which are open, which are

closed?

You'll be given number of doors, n.

You need to print out pair of (door_number, state) separated by '\n' aka 'end of line'. See

SAMPLE_OUTPUT for more clarity.

SAMPLE_INPUT:

3

SAMPLE_OUTPUT:

1,open

2,closed

3,closed

View All Comments