# Thread: need help with some basic stuff

1. ## need help with some basic stuff

Hello,

1. I AM A COMPLETE C++ NEWBIE
ok, maybe not totally, but i need a bit more explanation then the averege person

2. I am coding a ecosytem simulation which is not dynamic (hence meaning that there is no chance involved). It's based on this mathetmatical model -

(a/b * s) + (-c/d * s) + (a/b * s)

Basically, the person inputs two numbers which symoblize a ? out of ? chance of something being created, multiplied by the seconds. Then the person inputs two numbers which symbolize a ? out of ? of something being killed/destoryed, multiplied by the seconds. The next step is basically step 1. The remaining number is the end amount of this one specific speicies (i'm doing an ecosystem sim).

Here is what I need to know:

1. for step two, how do i make the number negative?
2. how do i make this friggen think work? LOL! put it this way, i'm not that bad of a coder, but i'm a horrible debugger, and i couldn't find an error if my life depended on it. please tell me any obvious mistakes.

Here is the code so far -

Code:
```#include <stdio.h>
main()
{
int a,b,c,d,e,f,g,h,i,j,k,l,m;
printf("\first number for creation");
scanf("%d",&a);
printf("second number of creation ");
scanf("%d",&b);
printf("number of seconds ");
scanf ("%d",&c);
d=a/b*c
printf("\first number of destruction");
scanf("%d",&e);
printf("second number of desturction ");
scanf("&d",&f);
printf("number of seconds ");
scanf ("&d",&c);
h=e/f*c
printf("\first number of creation");
scanf("%d",&i);
printf("second number of creation ");
scanf("&d",&j);
printf("number of seconds ");
scanf ("&d",&c);
l=i/j*c

m=d+h+l
printf("the final amount is %d /n,l");
}```

JOlszewski

2. (a/b * s) + (-c/d * s) + (a/b * s)
what about changing the equation to make things easier for you.
I believe that +(-c/d * s) is the same as - (c/d * s) meaning your equation will be the same as
(a/b * s) - (c/d * s) + (a/b * s)
Code:
```int equation;
equation = (a/b * s) - (c/d * s) + (a/b * s);
if( equation >= 0){ positive}
else{ negative }```
hope it helps.
Mas

3. > printf("\first number for creation");
Watch your use of \ inside strings - You're printing a form-feed character here

> d=a/b*c
All your calculations lack a ; at the end

> printf("the final amount is %d /n,l");
/ is not the same as \
The value needs to be outside the string
Say
printf("the final amount is %d\n",l);