Hello need Help

hello, I am back again asking for help. This is my last project and need extreme help!

this is the question:

Write a program that will calculate the simple interest (I =P*R*T) of an item. P is Principal, R is interest rate, and T is number of years. You will ask the user for input of P, R, and T, then based on that caluclate simple interest, I, and print to the screen. Save the program as ACT 7


Can you make it as simple as possible?

Thank you so much. I am in desperate need.
Give it a go first.

Won't help otherwise.
Won't help otherwise.


Unfortunately there are others who already did help by doing his homework for him so now he expects it. http://cplusplus.com/forum/general/69921/

No offense lilrj, but if you can't code a program that multiplies 3 numbers and prints the result you really shouldn't pass your class. Have you tried at all? We are very happy to help those who are actually trying to learn but you appear to be asking us to help you cheat!
ya thats true man, if you don't give it a go there is no way you can learn. am also a newbie but i do try my best and if things get block and i cant do it anymore i then seek for help
I just gave it a go and got it right. I had a couple errors but I fixed them. Youtube helps a lot lol

heres my code
Tell me how I did.


// Computer Science C++
// Seniors 2012

#include <iostream.h>

int main()
{
int I, P, R, T;

cout << " Enter a Principal ";
cin >> P;
cout << " Enter a interest rate ";
cin >> R;
cout << " Enter the number of years ";
cin >> T;

I = P * R * T;
cout << I;
return 0;
}
Nice attempt but I see a few issues. Did you get this to compile and run???

We may have different compilers but normally you need to specify the namespace for cout and cin. For example: std::cout << "Enter a Number:";

You can also put using namespace std; before your main(). That will automatically add it for the rest of you code. Some people like using this but others (like me) would rather specify the namespace manually to avoid possible clashes.

Also, interest rate should technically be a float since it's a percentage. The way you have it now the user would have to know that 18% should be entered as the integer 18. Most people would assume that they should enter .18 (which would be a percentage). Not a big deal though.

I would also add something like: cout << "Your calculated interest rate is: "; before you output the result (cout << I;) just to make it clear.

I'm glad you worked this through yourself. It's really the only way to learn to code. Youtube has some great tutorial videos so keep that up too.

BTW, if you select your code in a post and click the <> button to the right it will format your code to look good on this forum.

Keep up the good work!...
Thank you, and I took your advice. I compiled it and the command window ran perfect.
Topic archived. No new replies allowed.