What is the point of this
You dont even need that line of code, if you already declared it with an integer at the beginning.Code:mpgh1 = mpgh1 = 3;
hello guys
i just finished learning about variables and i incorporated it into my 2nd program, but i just want to know if i made any errors with the declarations or anything like that.
// C++ program Number 2
# include <iostream>
using namespace std;
int main ()
{
//declaring variables
int mpgh1;
int mpgh2;
// Process:
mpgh1 = 3;
mpgh2 = 1;
mpgh1 = mpgh1 = 3;
result = mpgh1 - mpgh2;
//functions to print out the results
cout << result;
//terminte (ends the program)
return 0;
}
msn: Dynamis-Kaizer@live.com
Steam: holyinvoker62
~Goals~
( ) 50 Posts
( ) 200 Posts
( ) 300 Posts
( ) 500 Posts
( ) 1000 posts
( )MSG 4 IN combat arms
( ) CSM 1 IN combat arms
( ) Learn C++
( ) Get a girlfriend
https://www.mpgh.net/forum/2-general/...t-develop.html
What is the point of this
You dont even need that line of code, if you already declared it with an integer at the beginning.Code:mpgh1 = mpgh1 = 3;
"The best way to predict your future is to create it."
Contributions I made:
DirectX E-Books
Hacking Tools
Hacking into a PC
Need Help?
Send me a PM, or send me a email at : aanthonyz10@gmail.com
Click My Dragon:
it was an accident i realized my mistake after i posted the thread
msn: Dynamis-Kaizer@live.com
Steam: holyinvoker62
~Goals~
( ) 50 Posts
( ) 200 Posts
( ) 300 Posts
( ) 500 Posts
( ) 1000 posts
( )MSG 4 IN combat arms
( ) CSM 1 IN combat arms
( ) Learn C++
( ) Get a girlfriend
https://www.mpgh.net/forum/2-general/...t-develop.html
Oh ok, well besides that its all good.
Bit of advice:
If your making a small program like this dont use:
just actually spell it out, so you can get into the habit of doing it. Only use it when your going to use cout or cin alot.Code:using namespace std;
"The best way to predict your future is to create it."
Contributions I made:
DirectX E-Books
Hacking Tools
Hacking into a PC
Need Help?
Send me a PM, or send me a email at : aanthonyz10@gmail.com
Click My Dragon:
CrypTology- (02-04-2011)
I use namespace std all the time even for one liners, because I'm a lazy bastard and I know how it works anyway.
EDIT: plus it get really old when you start using flags and end up with something like this: std::ios::in ... eww.
Last edited by why06; 02-04-2011 at 06:29 PM.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
CrypTology- (02-04-2011),Hell_Demon (02-05-2011)
CrypTology- (02-05-2011),Hell_Demon (02-05-2011)
thanks whit
msn: Dynamis-Kaizer@live.com
Steam: holyinvoker62
~Goals~
( ) 50 Posts
( ) 200 Posts
( ) 300 Posts
( ) 500 Posts
( ) 1000 posts
( )MSG 4 IN combat arms
( ) CSM 1 IN combat arms
( ) Learn C++
( ) Get a girlfriend
https://www.mpgh.net/forum/2-general/...t-develop.html
"The best way to predict your future is to create it."
Contributions I made:
DirectX E-Books
Hacking Tools
Hacking into a PC
Need Help?
Send me a PM, or send me a email at : aanthonyz10@gmail.com
Click My Dragon:
Oh, I completely missed that wow...
"The best way to predict your future is to create it."
Contributions I made:
DirectX E-Books
Hacking Tools
Hacking into a PC
Need Help?
Send me a PM, or send me a email at : aanthonyz10@gmail.com
Click My Dragon: