Page 2 of 3

Posted: Sun Oct 24, 2010 4:05 pm
by Erico
Atelo wrote:I got the impression he was looking for the line of C++ code that would calculate it, not just the math formula.
you are correct sir

Posted: Sun Oct 24, 2010 4:34 pm
by ascanius
So I'm mistaken; I know crap about programming. I thought you meant the basic equation.

Edited for painfully obviously mistake and clearly not helpful

Posted: Sun Oct 24, 2010 4:39 pm
by Erico
This is what my program looks like

#include <iostream>
using namespace std;
int main () {

int principle, years, interest;

cout<< "Please enter the starting principle, then the number of years it will\
be in the bank, and then the interest rate in percentage."<< endl;
cin>> principle >> years >> interest;

while (years >= 1 ){
principle = principle + (principle * interest / 100);
}
cout<< "You will have $" <<principle<< " in the bank."<< endl;
}




But it does nothing

Posted: Sun Oct 24, 2010 5:05 pm
by Atelo
Does nothing? Does it compile and do nothing? Does it give errors during compile or when executed? Does it give the wrong value?

I haven't programmed in 10 years but I remember including <stdio.h>, I have no idea if it's still needed.

There appears to be something wrong with your loop and use of 'years'.

Posted: Sun Oct 24, 2010 5:11 pm
by Erico
Hahaha I figured out what I did wrong, it should have been (i <= years) not the other way around.

Posted: Sun Oct 24, 2010 5:13 pm
by Atelo
Yea and then you must increment 'i'

i++;

Posted: Sun Oct 24, 2010 5:19 pm
by Erico
yeah, once i realize i had that written backwards, everything came rushing back to my mind lol. School is over rated >_<

Posted: Sun Oct 24, 2010 9:14 pm
by Ander
Atelo wrote: I haven't programmed in 10 years
Not true. You programmed me to lead raids and to be a ninja cyborg assassin. And you guys though Guapa left the guild lol.

-Ander

Posted: Sun Oct 24, 2010 9:17 pm
by Erico
Ander wrote:Not true. You programmed me to lead raids and to be a ninja cyborg assassin. And you guys though Guapa left the guild lol.

-Ander
lolz

Posted: Mon Oct 25, 2010 11:27 am
by Dartagn
I have no clue what is going on in this thread. I assume you are making fun of me somehow.

Fuck off.