Read about doing multiplication using Karatsuba method
(https://en.wikipedia.org/wiki/Karatsuba_algorithm ).
Write a C++ program which:
• Prompts user to enter two large integer numbers (x, y).
• Make a function called Karatsuba() which takes these two integers and returns the
multiplication result using Karatsuba algorithm.
o Your function should do parameter validation. Both numbers must be more
than 4 digits and less than 10 digits (don’t use strings). If parameters are not
valid then the function should return 0;
o The entered numbers could be negative or positive. For example: 820778 and
-58712979 where x is 6-digit positive number and y is 8-digit negative
number.
• You might need to make another helper function called getDigits() which will get an
integer as input and returns number of digits of that integer. getDigits() will help you
find the value of m and Bm.
• Finally, display result in the main function
Create a class: Person with member variables: name and age. Create two overloaded
constructors for this class along with a copy constructor. Also create a destructor. Include
member function, get_data(), to get the name and age of the person. Define a member function,
display_data() to display the member variables. Define objects for this class and showcase the
Happy Numbers: A number is called a happy number, if you start with the given number
and arrive at 1 by repeating the following process (as illustrated in the below example):
(a) compute the sum of the squares of given number digits
(b) if the resultant value is 1, then the number is happy number, else execute point (a) for
the newly produced number.
Note that if a number is not a happy number, there will be an endless loop to this execution.
Goal: In this question, you are required to write a recursive function that checks whether
the number entered by the user is a happy number or not for 10 cycles/iterations only. The
output shown in blue colour should be shown by the function and text in yellow colour
should be displayed by the main function.
Write a C++ program in which write a function convert() that converts a decimal number to a binary, octal, and
hexadecimal equivalents. The function will take two arguments: first argument will be
the number to be converted and second argument will be the base in which this number
is to be converted. Function should return the converted value. You may use strings to
represent converted numbers like “0x3A”, “00101100”, “72” etc.
b. Call convert() function in the main program to produce the following output. It is same
as you made in the previous assignment.
Example output:
Enter upper limit = 20
Enter lower limit = 30
Please enter a value of lower limit between 0 and the upper limit and try again.
Enter lower limit again = 10
............................................................................
Decimal Binary Octal Hexadecimal
Wite a C++ function. A college offers a course that prepares students for the state licensing exam for real estate brokers.
Last year, ten of the students who completed this course took the exam. The college wants to know
how well its students did on the exam. You have been asked to write a program to summarize the
results. You have been given a list of these 10 students. Next to each name is written a 1 if the
student passed the exam or a 2 if the student failed.
Your program should analyze the results of the exam as follows:
Input each test result (i.e., a 1 or a 2). Display the prompting message "Enter result" each time the
program requests another test result.
Count the number of test results of each type.
Display a summary of the test results indicating the number of students who passed and the
number who failed.
If more than eight students passed the exam, print the message "Raise tuition."
Write a program to overload operators in the same program by writing suitable operator member functions for following set of expressions: O5= (O1/O2) *(O3+O4) [Here O1,O2,O3,O4 and O5 are objects of a class “overloading”, and this class is having one integer data member]
Create a c++ class entertainment consisting of the following data members:
• Title
• Air_Date i.e. Release Date
• Genre
• Type (i.e. Movie, TV Show)
• Runtime
• Country
• Actors
• Rating.
Follow the instructions below for creating the class and objects: Store the owners name as a dynamic array data member.
• Store the genre as a dynamic array data member.
• Store the names of the actors as a dynamic array data member.
• Create an object named “obj1” and initialize the object.
• Create a copy constructor that can list of genre, country and rating.
• Generate another object named “obj2” that is created by copying only the genre, country and ratings from “obj1”.
• Initialize the remaining attributes with values of your own.
Write a program that randomly fills in 0s and 1s into a
6 X 6 matrix, prints the matrix and finds the first row and the first column with the
least 1s.
Write a program to overload operators in the same program by writing suitable operator member functions for following set of expressions:
O2=++O1;
O3=O2--;
O4=!O3;
O5=-O4;
[Here O1,O2,O3,O4 and O5 are objects of a class “overloading”, and this class is having one integer data member]
Write a program to overload operators in the same program by writing suitable operator member functions for following set of expressions:
O2=++O1;
O3=O2--;
O4=!O3;
O5=-O4;
[Here O1,O2,O3,O4 and O5 are objects of a class “overloading”, and this class is having one integer data member]