answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include<process.h>

char a[20],b[50],c[50],ch;

int i=0,n;

void sender();

void receiver();

void main()

{

clrscr();

sender();

receiver();

getch();

}

void sender()

{

int j=0,pos;

printf("\n\n Sender side \n\n");

printf("Enter string : ");

scanf("%s",&a);

n=strlen(a);

printf("\n Enter position : ");

scanf("%d",&pos);

label: if(pos>n)

{

printf("\n Invalid position, Enter again : ");

scanf("%d",&pos);

goto label;

}

printf("\n Enter the character : ");

ch=getche();

b[0]='d';

b[1]='l';

b[2]='e';

b[3]='s';

b[4]='t';

b[5]='x';

j=6;

while(i<n)

{

if(i==pos-1)

{

b[j]='d';

b[j+1]='l';

b[j+2]='e';

b[j+3]=ch;

b[j+4]='d';

b[j+5]='l';

b[j+6]='e';

j=j+7;

}

if(a[i]=='d' && a[i+1]=='l' && a[i+2]=='e')

{

b[j]='d';

b[j+1]='l';

b[j+2]='e';

j=j+3;

}

b[j]=a[i];

i++;

j++;

}

b[j]='d';

b[j+1]='l';

b[j+2]='e';

b[j+3]='e';

b[j+4]='t';

b[j+5]='x';

b[j+6]='\0';

printf("\nframe after stuffing : %s" ,b);

}

void receiver()

{

int j=6;

printf("\n\n\n\n Receiver side\n\n");

printf("\nThe data came from sender side is : %s",b);

n=strlen(b);

while(j<n-6)

{

if(b[j]=='d' && b[j+1]=='l' && b[j+2]=='e')

{

if(b[j+3]=='d' && b[j+4]=='l' && b[j+5]=='e')

{

c[i]=b[j+3];

c[i+1]=b[j+4];

c[i+2]=b[j+5];

i = i+3;

j = j+6;

}

else if(b[j+4]=='d' && b[j+5]=='l' && b[j+6]=='e')

{

j = j+7;

}

}

else

{

c[i]=b[j];

i++;

j++;

}

}

printf("\n\nOriginal data : %s",c);

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Byte stuffing program in c?

teri bhen ki.....................


How is memory allocated in c program for a character data type?

One byte for every character.


C program to find the largest and smallest character in a word?

helicopter


How long do you warm up prepared stuffing?

To reheat prepared stuffing, preheat the oven to 350°F (175°C) and cover the stuffing with foil. Heat it for about 20-30 minutes or until it reaches an internal temperature of 165°F (74°C). Stir occasionally to ensure even heating.


Why and operator can not be used in string of c program?

Any character can be used in string, except for \\0. char example [] = "A&amp;B|C";


What are the benefits of data stuffing?

The following data fragment occurs in the middle of a data stream for which the byte-stuffing algorithm described in the text is used: A B ESC C ESC FLAG FLAG D. What is the output after stuffing?


Write a program to adentify whether a character entered by a user is a vowel or a consonant?

You can check the value of a character by using if statements.Also, note that this code does not check for capital letters./* code */#include int main(){char c;c = getc(stdin);if (c 'o') {/* If the character is a vowel, this code will be executed. */} else if (c >= 'a' && c


Write a program to initialize a character and print whether it is uppercase lowercase or special character in java module 1?

I'll just write a function to do that, I hope the good people won't try to run it as it is.... void function() { char c = 'a'; if( c &gt;= 'a' &amp;&amp; c &lt;='z' ) System.out.println("LowerCase"); else if( c&gt;='A' &amp;&amp; c &lt;='Z' ) System.out.println("UpperCase"); else System.out.println("Special Character"); }


How long does it take tobake stuffing?

Baking stuffing typically takes about 30 to 45 minutes at a temperature of 350°F (175°C). If the stuffing is prepared in a casserole dish, you may want to cover it with foil for the first 20 minutes to retain moisture, then uncover it for the last part of cooking to achieve a crispy top. Always ensure the stuffing reaches an internal temperature of 165°F (74°C) for safety.


How is the getchar function used in a C program?

The getchar() is used in 'C' programming language because it can read the character from the Standard input(i.e..from the user keyboard),and converts in to the ASCII value.


How do you know when the stuffing is done?

Stuffing is done when it reaches an internal temperature of 165°F (74°C) if cooked separately or in the bird. It should be moist but not soggy, and the texture should be fluffy. If the stuffing is browning on top, it’s a good sign that it’s ready. Always check for even cooking by testing the center of the stuffing.