Defines a function that stores the elements of an array of real numbers in reverse, declaring the function as: void reverse (double arr[], const int size, double*& rev). Write a main program using the above function.
Write a definition of a distance class as shown in the example 4.2 above. Make all the appropriate function constant. Include a constant data member called id of integer type. Create two object constant and non-constant. Assign values and display them. Also check what happens If you try to modify private data member of an object from the definition of const function If you try to modify the private data member of const object from the definition of non-constant function.
A car completes its journey in three parts. It travels the first X km of its journey at an average
speed of x_Speed m/s and the next Y km at an average speed of y_Speed km/h. The car completes the
last part of its journey at an average speed of z_Speed km/h in z_Minutes minutes. Here X, x_Speed, Y,
y_Speed, z_Speed, and z_Minutes are all variables whose values you will have to take as an input from the
user. Find the average speed for its entire journey, giving your answer in km/h.
speed =
distance
time
Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).
Given values for red, green, and blue, remove the gray part.
Lets create your first cipher!!! Cipher is an algorithm that you can use to encrypt and decrypt
sensitive information. In an information system, sensitive information is stored in a 16-bit unsigned
number, where bit-wise information is stored in following format, 9-bits are reserved for account number
and 7-bits are reserved for customer ID.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
C C C C C C C A A A A A A A A A
a) Using bit wise operators, write a function to extract customer ID
b) Another function to extract account number.
c) Due to security concerns, you have been given a task to create a cipher. Write a function to
encrypt the 16-bit number (X) using the following expression.
y = aX + b, consider a = 5 and b = 233
d) Write another function to decrypt the number and display the original number.
Find and display the values of both sides of the following mathematical series expression and
an absolute difference of both sides. User can input either of angles in degree 90, 60, 30 etc.
sin(x) = x −
x
3
3!
+
x
5
5!
−
x
7
7!
+
x
9
9!
Once the user enters the angle in degrees. Your program should do the following (Write separate
functions for a, b, c, and d)
a) LHS Result
b) RHS Result
c) Difference
d) First term, series of two terms, series of three terms, series of four terms, series of five terms.
Machine Problem: The National Earthquake Information Center has asked you to write
a program implementing the following decision table
to characterize an earthquake based on its Richter scale number:
Richter Scale Number (n) Characterization
n < 5.0 Little or no damage
5.0 <= n < 5.5 Some damage
5.5 <= n < 6.5 Some damage; walls may crack or fall
6.5 <= n < 7.5 Disaster: houses and buildings may collapse
higher Catastrophe: Most buildings destroye
Can you share a concept of a function?
Find and display the values of both sides of the following mathematical series expression and
an absolute difference of both sides. User can input either of angles in degree 90, 60, 30 etc.
sin(x) = x −
x
3
3!
+
x
5
5!
−
x
7
7!
+
x
9
9!