Showing posts with label data. Show all posts
Showing posts with label data. Show all posts

Wednesday, 15 April 2020

C++ Question - Farenheit to Celcius

Q: Write a program which accept temperature in Fahrenheit and print it in centigrade.
Solution:

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
 float F,C;
 cout<< "\nEnter temperature in Farenheit : ";
 cin>>F;
 C=5*(F-32)/9;
 cout<<"Temperature in celcius is : "<<C;
 return 0;
}

Screenshot:

Saturday, 23 November 2019

The following data fragment occurs in the middle of a data

Q: 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?
 
Solution:
 
 After stuffing we get: A B ESC ESC C ESC ESC ESC FLAG ESC FLAG D.