[help]C++ beginner noob # 2

Posts 16–30 of 72 · Page 2 of 5
did i make a mistake by making result equal mpgh-mpgh2?
Quote Originally Posted by CrypTology- View Post
did i make a mistake by making result equal mpgh-mpgh2?
not at all, you just didn't declare result before you did it.

Code:
int result;

result = mpgh1 - mpgh2;
would've worked perfectly. Like mpgh1 and 2, result needs to be declared as a variable before it can be assigned a value.
//declaring variables
signed int mpgh1;
signed int mpgh2;
unsinged result (7);
// Process:
mpgh1 = 3;
mpgh2 = 1;
mpgh1 = mpgh1 + 3;
result = mpgh1 - mpgh2;


fixed it
Quote Originally Posted by CrypTology- View Post
//declaring variables
signed int mpgh1;
signed int mpgh2;
unsinged result (7);
// Process:
mpgh1 = 3;
mpgh2 = 1;
mpgh1 = mpgh1 + 3;
result = mpgh1 - mpgh2;


fixed it
alright so ima sound like a dumb ass for this and im prob gunna have to go read up on declaring variables again, but did you assign result a value of 7, and then change it like you did with mpgh1 and 2?

Cause if you did it's a bit odd but i guess it works :B

also the signed and unsigned is good practise, but there's no actual input option and you made the result positive, so technically there's no point at all for a situation like this in a simple little program :3
Quote Originally Posted by CrypTology- View Post
//declaring variables
signed int mpgh1;
signed int mpgh2;
unsinged result (7);
// Process:
mpgh1 = 3;
mpgh2 = 1;
mpgh1 = mpgh1 + 3;
result = mpgh1 - mpgh2;


fixed it
OMG... it's soooo long. Remember to make code more shorter, like this:
Code:
//declaring variables
     int mpgh1;
     int mpgh2;
     unsinged result;
      // Process:
      mpgh1 = 3;
      mpgh2 = 1;
      mpgh1 += 3;
      result = mpgh1 - mpgh2;
When You're making signed int, there's no need to write signed int. Just int is enough.
I don't see any point of assigning value 7 to result.
Instead of mpgh1 = mpgh1 + 3; write mpgh1 += 3;. It's the same. You can make this for other mathematical operations (mpgh1 *= mpgh2 means this same what mpgh1 = mpgh1 * mpgh2).
If you will have any other questions, don't be afraid to ask.
Quote Originally Posted by mookamoka3 View Post
He didn't declare result :P he basically just assigned a value to some random letters :3


he did not have to


result = mpgh1 // it tell that result equal 3 almost like this

int result;
int mpg1 = 6;
int mpg2 = 4;
result = mpg1 - 6; // he assign result to the number 6
Quote Originally Posted by bkbatman View Post
he did not have to


result = mpgh1 // it tell that result equal 3 almost like this

int result;
int mpg1 = 6;
int mpg2 = 4;
result = mpg1 - 6; // he assign result to the number 6
I think that You don't understand. He didn't declare variable named 'result'. He didn't have
Code:
int result
or
Code:
float result
.
lmao
Quote Originally Posted by kamilos93 View Post
I think that You don't understand. He didn't declare variable named 'result'. He didn't have
Code:
int result
or
Code:
float result
.


he did not have to for the last time u dont understand

as long he did this

int mpg1 = 3;

result = mpg1; // it tell that result = the same number as the mpg1 he did not have to variable this it a simple program beside what u know

if u think know better then me prove it
Quote Originally Posted by bkbatman View Post
he did not have to for the last time u dont understand

as long he did this

int mpg1 = 3;

result = mpg1; // it tell that result = the same number as the mpg1 he did not have to variable this it a simple program beside what u know

if u think know better then me prove it
Your an idiot..
The compiler is not going to know what result is...
Quote Originally Posted by bkbatman View Post
he did not have to for the last time u dont understand

as long he did this

int mpg1 = 3;

result = mpg1; // it tell that result = the same number as the mpg1 he did not have to variable this it a simple program beside what u know

if u think know better then me prove it
You need to declare something for it to exist. And a declaration starts with a data type

int result = mpgh1; would work

If it is not declared the compiler won't know what result is.

Its the same as trying to go

int whitsPowerLevel = 8999
result = whitsPowerLevel
cout << &result

cant get the address of result if it doesnt exist
az
but it different it just basic start like 6 line of code

not like he going far so the compiler would know
Quote Originally Posted by bkbatman View Post
???????????????????????
Also, if its type isnt declared, how will the computer know how much memory to allocate for it?

we win
o_O
Quote Originally Posted by Auxilium View Post


Also, if its type isnt declared, how will the computer know how much memory to allocate for it?

we win
and beside what type of stuff have u every made in C++
anytype of game engine any type of trainer ?
i would like to see
Quote Originally Posted by bkbatman View Post
and beside what type of stuff have u every made in C++
anytype of game engine any type of trainer ?
i would like to see
Learn to speak english please.

And stop changing the subject.

If the type isn't declared, the computer wont know how much memory to allocate for the variable.

And a few months back i made a particle emitter, go find it

And in case you didnt know, C++ isnt just for trainers or engines.
rofl
Quote Originally Posted by Auxilium View Post


Learn to speak english please.

And stop changing the subject.

If the type isn't declared, the computer wont know how much memory to allocate for the variable.

And a few months back i made a particle emitter, go find it
u guy are really sorry on this forum one of the failed forum every created for hacker i am too advance to be on a low class forum as this
Posts 16–30 of 72 · Page 2 of 5

Post a Reply

Tags for this Thread

None

Talk with us