Write a program that finds the factorial value of a given number as shown. Display an appropriate error message if the number entered is negative, or too big for the answer to be correctly calculated.

Enter a non-negative integer : 5

5 x 4 x 3 x 2 x 1 = 120


3. Write a program that allows the user to input a monthly investment, annual rate of return (monthly rate is 1/12th) and number of months to track. The program will display the starting balance, interest earned, deposit and ending balance for each month. Here is a sample run :

Monthly Investment : 200
Annual Interest Rate (%) : 12
Term ( Months ) : 4

Starting Interest Monthly Ending
Balance Earned Deposit Balance
-------- -------- ------- -------
0.00 0.00 200.00 200.00
200.00 2.00 200.00 402.00
402.00 4.02 200.00 606.02
606.02 6.06 200.00 812.08


4. Create a simple game of HI-LO, where the computer picks a random number from 1 to 100 and the user guesses at it repeatedly until guessed correctly. After each guess, the computer will say "Higher", "Lower" or "Correct" and keep track of the number of guesses. You will need the following code to access random numbers.

#include<stdlib.h>
randomize(); should be inserted once at start of program
answer = random(100) + 1; will store a random number from 1 to 100 in variable answer

Recommended Answers

All 6 Replies

Yeah, I need a million cdn dollars maybe we can work out a deal.

lol seriously sir... its due tomorrow....

Until you show some effort and post some code with specific questions, nobodies going to help you.

doesnt look that hard, I bet you have a lot of simillar example if you have notes??
the only problem I cant help you because I am doing a project taking me a month of non stop coding, :/

doesnt look that hard, I bet you have a lot of simillar example if you have notes??
the only problem I cant help you because I am doing a project taking me a month of non stop coding, :/

no problem....:)

These are incredibly easy. I'm pretty new to C++ and I can tell you're just starting out. Answers to these are no doubt in your book. Or if you're too lazy to flip the pages a couple google searches will answer these for you. Just step through each problem logically. They're simple math equations. In your programs: 1) identify your variables 2) plan your algorithm 3) make some psuedocode to help it all make sense in your head 4) look through notes, your textbook, the internet to find ways to translate your psuedocode to c++ code 5) do the work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.