by CodeChum Admin
A mitosis program has gone out of hand and now does abnormal cell duplication. Rather than scrapping the project, the researchers decided to observe and predict the cell duplication using a program.
Instructions:
Input
1. Base integer
2. Initial factor
3. Number of times to process
Output
Enter·base·integer:·3
Enter·initial·factor:·2
Enter·number·of·times·to·process:·3
Result·=·54
by CodeChum Admin
In order to preserve Spiderman's last words, Mr. Stark wants us to create a program that takes a string and output the string with each proceeding output having one less character until it outputs only one string.
Instructions:
Input
1. String to be processed
Output
Enter·string:·Hello!
Hello!
Hello
Hell
Hel
He
H
by CodeChum Admin
In life, good things take time.
Let's make a simple program that mirrors this beautiful idea where we ask the user for two integer inputs. The first one would represent the starting number and the second one would represent the next n integers after it.
For example, if the first number inputted is 2 and the second number inputted is 3, then the output would be 3, 4, 5 because these are the next 3 integers after 2.
Instructions:
Input
1. Starting integer
2. Number of integers
Output
Enter·starting·integer:·2
Enter·how·many·next·integers:·3
3·4·5
The String_collection.txt file contains 4000 random English names (keys), write a C++ program that generates hash codes for each key using polynomial accumulation.In addition your program should perform the following tasks. consider a=37 [constant]
Write separate function for each task and call it in proper order
1. Create a hash table to store the keys based on the hash values generated
➢ Hash value: h(key)=|hash code| mod N , use appropriate value for N
➢ For collision handling use separate chaining
1.1. Write a function insert(key), and find(key) to insert and find the key in the hash table.
1.2. Write a display function that display all the keys in ascending order of hash values (line-wise) such that each line display the keys (names) having the same hash value.
1.3 Find the hash value with maximum number of collisions and display all the string associated with this hash value
2. Compare the total number of collisions for a=33, 37, 39, 41
2.1. Display the total number of collisions occurred for each case
write a C++ program that generates hash codes for each key using polynomial accumulation. In addition your program should perform the following tasks. consider a=37 [constant]
A teacher divides her class in different group (gr) sizes according to the
activity they have to do. Write a program to determine the number (nr) of groups as well as the nr of pupils (p) who are left to form a smaller gr. They're 56 in the class.
Program structure:
• Declare 3 int variables nrPupils, nrGroups, and nrLeft. nrPupils is the
nr of ps in a class, nrGroups is the nr of grs the class is divided into, and nrLeft is the nr of ps who're in the remaining smaller gr.
• Assign the value 56 to nrPupils.
• Declare an int variable groupSize that's used by a cin statement to input a value from the keyboard and store the size of the grs the teacher requested. Display a message. E.g. Please enter the size of each gr?
• Write the statement to calculate the nr of grs of size groupSize.
• Write the statement to calculate the nr of ps who're in the remaining smaller gr.
The output of the program must be displayed as follows:
There are 9 grs consisting of 6
pupils There are 3 remaining pupils
Find a good cookbook. Read the instructions for your favourite dish. Write a program to display the recipe on the screen but with a difference. The quantity of each ingredient must be multiplied by a value entered from the keyboard. For example, if the recipe needs 2 cups of flour the output displayed will be something like this Please enter the factor to multiply the ingredients with : 4 Recipe name Ingredients // other ingredients 8 cups flour Method The program has the following structure: • Declare an int variable named mFactor to store the value with which the quantity of each ingredient must be multiplied. • The program must make use of a cin statement to input a value from the keyboard and store it in mFactor. Submit both your program and output.
Write a program in C++ to read a number n and find out the sum of the integers from 1 to
then from 1 to 3, then 1 to 4, and so on and to display the sum of the integers from 1 to
n.
For example, from
1 to 2 = 1
1 to 3 = 3
1 to 4 = 6
1 to 5 = 10
1 to 6 = 18
Develop a small application in C++ that should allow the user of application to enter the receipt number, sender name, sender address, receiver name, receiver address, shipment fee and parcel weight. After getting required information, generate a shipment receipt and show as summary on screen.
Write a program to determine the entered character is an alphabet or number or special character using if – else-if – else.
Instruction: This program read a character value from the user and displays whether it is an alphabet or number or special character, with a suitable message.