Q: Suppose there is link list as follows:
Element : Address
5 : 1000
10 : 1500
15 : 2000
20 : 3000
You need to write a pseudo code to insert new node after (15) and set its value as
18. You can suppose the values of address.
A prime number is called an Additive prime if the sum of its digits is also a prime
number. Write a program that will display the N (user input) number of additive prime numbers
and displays the output in the following format:
Prime number
Sum of its digits
2
2
3
3
...
11
2
using user-defined functions
Sample output:
Enter an integer: 10
Prime number Sum of Digits
2 2
3 3
5 5
7 7
11 2
23 5
29 11
41 5
43 7
47 11
Write program that implements a function with the following header to display all
the even digits in an integer:
void displayEven(int number)
For example, displayEven(345) displays 4. Write a test program that prompts the
user to enter an
integer and displays the even digits in it. Using User define functions
Sample output:
Enter an integer: 123456789
8 6 4 2
Write a c++ program that implements the functions with the following headers:
// Return the sum of the cubes of the digits in an integer,
// i.e., cubeOfDigits(131) returns 13 + 33 + 13 = 29
int cubeOfDigits(int number)
// Displays if integer is an Armstrong integer
void isArmstrong(int number)
Use cubeOfDigits to implement isArmstrong. An integer is an Armstrong integer(order of 3) if the sum of the cubes of its digits is equal to the number itself. Write aprogram that will print all the
Armstrong numbers within the range of 1 up to 1000.
Example program:
1
153
370
371
407
Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".
Let's try this out now!
Write recursive procedures for the following problems :
1)Factorial
2)Print linked list
3)Print reverse linked list
Define username and password as array variables
In the program, set an initial value for the variables
The user should be able to login using the default credentials
The program should be able to change the default values of the array
If the user tries to login using wrong credentials he will be asked to re-login but after 3 wrong attempts the program will display "You've exceeded the allowable number of tries! Try again later"
If the user successfully logged in, the message "Welcome to my World" should be displayed on screen
If this can done in a user-define function, it would be better but not required for now.
SCREEN LAYOUT / DESIGN
(prompt 1)
Username: default
Password: admin
Change Username and Password
[Y/N]: Y
(prompt 2)
Username: correct UN
Password: correct PW
Welcome to my World
(prompt 3)
Username: wrong UN
Password: wrong PW
(for the 3rd time)
You've exceeded the allowable number of tries! Try again later
Write a program to create a class shape with functions to find volume of the shapes and display the name of the shape and other essential component of the class. Create derived classes sphere , cuboid and cone each having overridden functions area and display. Write a suitable program to illustrate virtual functions and virtual destructor
Write a C++ program which:
• Prompts user to enter two large integer numbers (x, y). Both numbers must be more
than 4 digits and less than 10 digits (do input validation, don’t use strings). 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.
• Make a function called Karatsuba() which takes these two integers and returns the
multiplication result using Karatsuba algorithm. 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.
• Display result in the main function.
Write a program that displays the following menu to the user:
Press 1 for Permanent Employee
Press 2 for Daily wages Employee
After selecting the appropriate employee calculate salary and medical charges for the employees. Following menu would be displayed:
Press a to calculate Salary
Press b to calculate medical charges.
The daily wages employees are paid 400 per hour while permanent employees are paid 800 per hour.When you would calculate the salary, first you need to ask for the number of hours for which the employee has worked so far. The permanent employees are paid 5% medical charges of their total salary while daily wages are paid 3% of medical charges. For calculating medical allowance no further selection/input is required.