Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

10, 20, 4, 5, 30, 1, 6, 3, 9, 60, 70, 90



Simulate the recursion for in-order and post order traversal of BST

10. If the variable divisor is not zero, divide the variable dividend by divisor, and



store the result in quotient. If divisor is zero, assign it to the quotient. Then print



all the variables. Assume the dividend and divisor are integer and quotient is a



double.



11. write a program that create the following number patern.



1 2 3 4 5 6 7 8 9



1 2 3 4 5 6 7 8



1 2 3 4 5 6 7



1 2 3 4 5 6



1 2 3 4 5



1 2 3 4



1 2 3 1 2



1



12. Write a program that accepts student mark out of 100, and return the



corresponding letter grade based on the following condition:



if mark is greater than or equal to 90 A



if mark is greater than or equal to 80 and less than 90 B



if mark is greater than or equal to60 and less than 80 C



if mark is greater than or equal to 40 and less than 60 D



if mark is less than 40 F



for other cases NG



N.B write the program using both switch and else-if



6.write for loop that will produce each of the following sequence  2, 4, 6, ….44




 5, 7, 9,…...45




 The sum of numbers between 2 to 44 inclusive




 The sum of the first 20 numbers in the series 1, 4, 7, 10…




7.Re write the following code fragment using one switch statement




if (ch = = ‘E’|| ch= = ‘e’)




cout<<" this is either the value of ‘E’ or ‘e’";




else if (ch = = ‘A’|| ch= = ‘a’)




cout<<" this is either the value of ‘A’ or ‘a’";




else if (ch = = ‘r’|| ch= = ‘i’)




cout<<" this is either the value of ‘i’ or ‘r’";




else




cout<<" Enter the correct choice";




8.Write a C++ program for the following flowchart. N.B Let the user enter the




initial value of X and Y, finaly your program should return the value of X, Y and




Z.




9.If the originally x=2 ,y=1 and z=1, what are the value of x, y, z after executing the




following code?




Switch(x)




{




case 0 : x = 2;




y =3;




case 1 : x =4;




Default:




y = 3;




x = 1;






1.Write a program which inputs a person’s height (in centimetres) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria:

Underweight: weight < height/2.5

Normal: height/2.5 <= weight <= height/2.3

Overweight: height/2.3 < weight


2.Write a program which inputs a date in the format dd/mm/yy and outputs it in the

format month dd, year.

For example, 25/12/61 becomes: December 25, 1961

3.Write a program which produces a simple multiplication table of the following format for integers in the range 1 to 9:

1 x 1 = 1

1 x 2 = 2

9 x 9 = 81

4.Write a program which inputs an integer value, checks that it is positive, and outputs its factorial, using the formulas:

factorial(0) = 1

factorial(n) = n × factorial(n-1)

5. Write a program that display numbers from 0 to 10 using three loops.










1) Create a Binary Search Tree (BST) that perform the following operations:



- Insertion of a node in BST


- Deletion of a node in BST


- Searching a node in BST




write a program to read an input file to get the number of sentences.

with specifications:

1. count 'A' and 'a' as the occurence of the leter a

2. the two same words should only be recorded once. 

3. ignore non-letter characters ( spaces, punctuation, etc)

4. do not list letters that donot occur at leasr once.

all operations must be done using dynamic array and pointers.


input file 1:

3

My dog did my homework.

My cat is not at home!

Happy New Year!


Write a C++ program that inputs the price of a shoe in a shop, then deducts the discount from the price of the shoe as follows:

20% discount if the price of the shoe is above or equal 40 BD.

10% discount if the price of the shoe is more than or equal 15 BD and less than 40 BD.

5% discount if the price of the shoe is more than or equal 7 BD and less than 15 BD.

0% discount if the price of the shoe is below 7 BD.

Then, your program should output:

The initial shoe price, the discount amount and the final shoe price after discount.

All numbers should be displayed with 2 decimal places.

3. Loading...

by CodeChum Admin


I wanna experiment on looping through a range of numbers that will be randomly inputted by the user. However, I don't want to let them see the loading percentage that is divisible by 4, so please exclude those for me when printing it out.




Thank you!






Instructions:


Input two integers in one line. The first inputted integer will be the starting point, and the second one shall serve as the ending point.

Use the power of loops to loop through the starting point until the ending point (inclusive), and print out each number within the range with the corresponding format shown on the sample output. However, skip the printing of statement if the integer is divisible by 4. Tip: Utilize the continue keyword to complete the process.

Input


A line containing two integers separated by a space.


2·10

Output


Multiple lines containing a string and an integer.


Loading...2%

Loading...3%

Loading...5%

Loading...6%

Loading...7%

Loading...9%

Loading...10%


2. Not My Favorites

by CodeChum Admin


We've already done looping through a series of numbers and printing out its squares, so how about we level it up and go with cubes this time?




I have a condition though; I don't want to be associated with numbers that are divisible by 3 or 5 so if an integer is divisible by either of the two, don't make their cube values appear on the screen, please.




Care to fulfill my request?






Instructions:


Print out the cube values of the numbers ranging from 1 to 20 (inclusive). However, if the number is divisible by either 3 or 5, do not include them in printing and proceed with the next numbers. Tip: When skipping through special values, make use of the keyword continue and put them inside a conditional statement.

Output


Multiple lines containing an integer.


1

8

64

343

512

1331

2197

2744

4096

4913

6859


Needle in the Haystack

by CodeChum Admin


Let's now try finding a certain digit into an integer! Come and join in on the fun and code with me!






Instructions:


Input two integers in one single line. The first inputted integer must be within 0-9 only.

Using loops, identify if the first inputted integer (0-9) is present in the second inputted integer. If it is found, print "Yes"; otherwise, print "No". Tip: If the number is already found even without reaching the end of the loop, use the break keyword to exit the loop early for a more efficient code.

Input


A line containing two integers separated by a space.


1·231214238

Output


A single line containing a string.


Yes


LATEST TUTORIALS
APPROVED BY CLIENTS