Hey you programming nerds

Open to all topics
Erico
Junior Member
Posts: 1183
Joined: Sat May 30, 2009 10:49 am

Post 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
WORLD OF LOGS #1's

Force choking the shit out of bitches!
User avatar
ascanius
Posts: 1110
Joined: Tue Apr 04, 2006 1:56 am
Location: The Farm

Post 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
Image
Erico
Junior Member
Posts: 1183
Joined: Sat May 30, 2009 10:49 am

Post 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
WORLD OF LOGS #1's

Force choking the shit out of bitches!
User avatar
Atelo
Posts: 7656
Joined: Thu Dec 29, 2005 6:47 pm

Post 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'.
Erico
Junior Member
Posts: 1183
Joined: Sat May 30, 2009 10:49 am

Post by Erico »

Hahaha I figured out what I did wrong, it should have been (i <= years) not the other way around.
WORLD OF LOGS #1's

Force choking the shit out of bitches!
User avatar
Atelo
Posts: 7656
Joined: Thu Dec 29, 2005 6:47 pm

Post by Atelo »

Yea and then you must increment 'i'

i++;
Erico
Junior Member
Posts: 1183
Joined: Sat May 30, 2009 10:49 am

Post by Erico »

yeah, once i realize i had that written backwards, everything came rushing back to my mind lol. School is over rated >_<
WORLD OF LOGS #1's

Force choking the shit out of bitches!
User avatar
Ander
Junior Member
Posts: 2900
Joined: Sat Dec 31, 2005 5:50 pm

Post 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
It's kind of like watching "The Guild" and realizing you're one of the characters.
Erico
Junior Member
Posts: 1183
Joined: Sat May 30, 2009 10:49 am

Post 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
WORLD OF LOGS #1's

Force choking the shit out of bitches!
User avatar
Dartagn
Posts: 2778
Joined: Sun Jan 01, 2006 10:45 pm
Location: San Diego, CA
Contact:

Post by Dartagn »

I have no clue what is going on in this thread. I assume you are making fun of me somehow.

Fuck off.
Call me Ron
Post Reply