Home › Forums › C Programming › Help Please
- This topic has 1 reply, 2 voices, and was last updated 15 years, 3 months ago by GWILouisaxwzkla.
Viewing 1 reply thread
- AuthorPosts
- August 10, 2009 at 7:17 pm #2221JavierLathropParticipant
I’m pretty new to C Programing and I am trying to make a very basic calculator that calculates interest. If anyone could give me some ideas that would be great because everytime I try running my programs it either spits out a random number or the program freezes.
Any help would be much appreciated. Thank You.
- August 11, 2009 at 6:28 pm #3602GWILouisaxwzklaParticipant
could try:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758<br />/****************************************************************<br />* File Name : c:programstempCG.cpp<br />* Date : August,11,2009<br />* Comments : new project<br />* Compiler/Assembler : Visual C++ 6.0<br />* Modifications :<br />*<br />*<br />*<br />*<br />*<br />* Program Shell Generated At: 2:00:25 p.m.<br />=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /><br /><br />#include <br />//#include <br />//#include <br />//#include <br />//#include <br />//#include <br /><br />using namespace std;<br /><br />//main function ******************************<br /><br />int main ( )<br />{<br /><br />int numberYears;<br />float interestRate;<br />int initialAmount;<br /><br />cout << "enter intial amount: ";<br />cin >> initialAmount;<br /><br />cout << "enter the interest rate: ( rate % ) " ;<br />cin >> interestRate;<br />interestRate = interestRate / 100;<br />cin.get ();<br /><br />cout << "enter number of years: ";<br />cin >> numberYears;<br /><br />cout << "amount plus interest: ";<br />cout << initialAmount + ( ( interestRate * initialAmount ) * numberYears ) ;<br />cout << endl;<br /><br /><br /><br />return 0 ;<br />}<br /><br /><br /><br /><br />output:
12345678<br />enter intial amount: 100<br />enter the interest rate: ( rate % ) 10%<br />enter number of years: 2<br />amount plus interest: 120<br />Press any key to continue<br /><br />
- AuthorPosts
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.