Hi, I'm new to C++ (only started on saturday), and I'm trying to make my first program that is actually useful. I'm trying to chart population growth using the formula:
(Where N is the starting population, R is the growth in %, A is the length of time of the growth, and P is the population after the growth has happened)P = N(1+R)^A
Anyway, I want to just start off with it being over 1 year, which eliminates A from the equation.
Here is my code:
The declared-but-unused variables may be used by me later on. I used:Code:int X, Y, Z, A, B; int C = 100; cout<<"What is the population that is going to grow? \n"; cin>>X; cin.ignore(); cout<<"\nWhat is the growth rate, in %?\n"; cin>>Y; cin.ignore(); Y/=C; X*(1+Y)=Z; cin.get();
To get around the problem of "error C2106: '=' : left operand must be l-value"Code:int C = 100 Y/=C
But now, with the 'X*(1+Y)=Z' I've hit that problem again, and I don't know how to get around it. If it matters, my compiler is Visual C++ Express Edition.
Anyone know how, or can someone point me towards a guide to doing maths in C++?