1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SOVA2 [1]
3 years ago
9

Program for bit stuffing...?

Computers and Technology
1 answer:
Olegator [25]3 years ago
4 0

Answer: Program for bit stuffing in C

#include<stdio.h>

      int main()

    {    

          int i=0,count=0;

          char data[50];

          printf("Enter the Bits: ");

          scanf("%s",data);            //entering the bits ie. 0,1  

          printf("Data Bits Before Bit Stuffing:%s",databits);

          printf("\nData Bits After Bit stuffing :");

          for(i=0; i<strlen(data); i++)

              {

              if(data[i]=='1')

                     count++;

              else

                     count=0;

                printf("%c",data[i]);

             if(count==4)

                {

                          printf("0");

                          count=0;

                 }

             }

    return 0;

 }

Explanation:

bit stuffing is the insertion of non-information bits during transmission of frames between sender and receiver. In the above program we are stuffing 0 bit after 4 consecutive 1's. So to count the number of 1's we have used a count variable. We have used a char array to store the data bits . We use a for loop to iterate through the data bits to stuff a 0 after 4 consecutive 1's.

You might be interested in
Given ProblemSolution class. Use a pointer to object of "ProblemSolution" class to invoke the "CalculateSum" and "Print" methods
faltersainse [42]

Answer:

#include <iostream>

using namespace std;

class  ProblemSolution {

private:

int num1, num2;

public:

ProblemSolution(int n1, int n2) {

 num1 = n1;

 num2 = n2;

}

int calculateSum() {

 int sum = 0;

 sum = num1 + num2;

 return sum;

}

void printSum() {

 // calculateSum will return sum value that will be printed here

 cout <<"Sum = "<< calculateSum();

}

~ProblemSolution() {

 cout << "\nDestructor is called " << endl;

};

};

int main() {

int a, b;

cout << "Enter a: ";

cin >> a;

cout << "Enter b: ";

cin >> b;

// Initiallizing object pointer of type ProblemSolution

ProblemSolution *objPtr = new ProblemSolution(a,b);

// printing Sum

objPtr->printSum();

// delete objPtr to relaease heap memory :important

delete objPtr;

return 0;

}

Explanation:

we will initialize  a pointer "objPtr" and initallize the constructor by passing 2 values a and b followed by the keyword  "new". the keyword "new" allocates memory in the heap. we can access class member functions using arrow "->". it is important to delete objPtr at the end of the program so that the heap memory can be freed to avoid memory leakage problems.  

3 0
3 years ago
How do I create a videogame
mote1985 [20]

Answer:

-Learn how to code

-Make Character

-Design

-Go to classes

-Go on video game platforms and make an video game(rblx is the best in my opinion)

-Play video games and see the scripts

-Decide what type of video game your making(horror, family game, battle game, etc.)

Explanation:

3 0
3 years ago
In MLA formatting, which of the<br> following is correct?
sveticcg [70]

Answer:

what?

Explanation:

8 0
3 years ago
What runs horizontally and is identified with numbers?
timama [110]
The answer to this question is C. Row
In excel, The number of Rows will be placed on the Left side of the sheet.
Rows will be utilized together with a column in order to differentiate specific cells with another.
This differentiation will be useful if user wanted to create a certain formula within the sheets
4 0
4 years ago
Read 2 more answers
At the beginning of the week a particular stock sold for 29 3/8 per share. At the end of the same week it sold for 31 2/8. What
vlada-n [284]

<span>31 2/8 minus 29 3/8
( 31 + 2/8 ) minus ( 29 + 3/8 )
2 plus ( 2/8 - 3/8 )

</span><span>2 minus 1/8 
1 7/8 answer</span>
7 0
4 years ago
Read 2 more answers
Other questions:
  • What products use fabric manipulation
    8·1 answer
  • Press the enter key in all of the following circumstances except _____.
    12·1 answer
  • In today's society, unethical actions are: A) Easier than ever to get away with, because the general public and insurers are les
    13·2 answers
  • Which of the following is a preferable method to secure wireless access in a SOHO?
    6·1 answer
  • 1.Write the Qbasic program to find sum of any 10 different numbers.
    12·1 answer
  • A _____ defines what must take place, not how it will be accomplished.​
    12·1 answer
  • Describe data center technology and its relevance to modern-day cloud computing. Support your opinion with cited information.( S
    14·1 answer
  • How does a scriptwriter show the design team how different player actions should affect the game?
    6·1 answer
  • Explain briefly what would happen if marketing research is not conducted before a product is developed and produced for sale.
    14·1 answer
  • When you hear the word "automation" what comes to mind?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!