# Thread: Help with +,-,* etc..

1. ## Help with +,-,* etc..

Hey dudes and dudettes

I want to do a "mathematical program", i started out like this that i have underneath, and I want to end up the program by first doing an mathematical equation (which i can find out by myself) and present how many days it'll take for him to save up to that amount of money. The thing is, how do I continue with the code to do a multiplacation and division etc.. do u know what i mean?

Micheal

Code:
```#include <iostream.h>
#include <stdlib.h>

int main()
{

int salary,rent,lon;

cout<< "How much do you want to save up too? ";
cin>> lon;
cout<< "\n";
cout<< "How much do you put in your bank per month? ";
cin>> salary;
cout<< "\n";
cout<< "What is the bank rent per year? ";
cin>> rent;
cout<< "\n";
cout<< "You want to have "<< lon << " kronor" << " by putting in "<< salary << " kronor per month with a rent of " << rent << " percent per year.\n";

system("PAUSE");
return 0;
}```

2. Um, no I don't know what you mean. Like this?
Code:
```int A = 3;
int B = 5;
std::cout << A << " * " << B << " = " << A * B << std::endl;```

3. humm.. i mean, first the user is gonna give out his variables for salary, lon, rent ... then i want to multiply the salary with 12 (months) and multiply it with the RENT and then find out how many yrs it'll take for him to save up to that bit of amount he wants..

Regards,
Micheal

4. You basically do the code the same as you'd write the formula in your math class. Show us the formula to get the result and will help you convert that to C++ code

5. okay now yea I understand! Thanks for the help dudes! One more thing though, in which he writes in his "rent" it is meant to be in procentual form.. meaning if he types 2, then i will take it as 2% .. but mathemtically in C++ how do I add 2% of an certain sum? (IRL i need to do 'certain sum' multiply with 1,02)

Best Regards,
Micheal

6. Code:
```float rent;

cout << "Enter rent: ";
cin >> rent;
rent = rent / 100;```

7. thanks dude alphaoide! can you tell me what float is?
thankks again!!

8. float allows you to store numbers such as 1.00, 1.02, 10.5, 10.456
int only store whole numbers as 1, 2 , 100
Code:
```int num = 5;

num = num / 2;   num is now "2" instead of the intended "2.5"```

9. erm dude.. is this the right way to start the code with float and int

Code:
```int main()
{

int salary,lon;
float rent;
cout<< "........```

10. You mean the order you declare the variables? Doesn't matter.

11. okay so far i've done this (underneath), now i just got to find a way so that it does the equation over and over again until the sum of it becomes the sum of the "lon" which is the sum he wanted from the beginning..did i confuse u as i confused myself? :P

Code:
```#include <iostream.h>
#include <stdlib.h>

int main()
{

int salary,lon;
float rent;
cout<< "How much do you want to save up too? ";
cin>> lon;
cout<< "\n";
cout<< "How much do you put in your bank per month? ";
cin>> salary;
cout<< "\n";
cout<< "What is the bank rent per year? ";
cin>> rent;
cout<< "\n";
cout<< "You want to have "<< lon << " kronor" << " by putting in "<< salary << " kronor per month\nwith a rent of " << rent << " percent per year.\n\n";
cout<< "In one year you'll have " << salary*12*(rent/100+1) << " kronor.\n";

system("PAUSE");
return 0;
}```

12. do u know how to construct a loop at all
http://www.cprogramming.com/tutorial/lesson3.html