start a code? do you always start with include <iostream> ? and what should i always keep in mind when working with codes?
Printable View
start a code? do you always start with include <iostream> ? and what should i always keep in mind when working with codes?
You generally start it with a tutorial.
Cheers
Apparently we have a new forum bug. They have zero posts, and yet, there is one...
Quzah.
Push the big red button.
But actually, in every console program you need to have main().
Will be the format for your most very basic programs. You might want to read some tutorials to learn about variables, conditional testing, and all sorts of other goodies to get you off the ground.Code:int main(){
//Code....
return 0;
}
That lovely iostream file isn't ALWAYS needed, but in most console programs in C++, it's pretty much a neccesity. It contains several input and output functions, like cin (C input) and cout (C output), which take in data from the user and print out data, respectively.
Come on now... This is a CS board. :) </inane remark>Quote:
Originally Posted by quzah
that's odd, I thought they were classes, which was always a C++ thing... why would they be called C input and output if they are a C++ thing?Quote:
Originally Posted by Krak
squawktheelf: the correct answer is: start every program with a comment. The name of the program, a brief description, and your name. it's also a good idea to include the date.
>>why would they be called C input and output if they are a C++ thing?
They're "console in" and "console out".
And I agree with Zach, a tutorial is usually a good place to start :)
That is correct for you for now sir.
and it's "sarcasm" :DQuote:
Originally Posted by Hunter2
Code:int main(){
for (;;){
SpreadViruses();
Hack_Govt_Agencies();
}
return 0;
}
Why are we hacking Govtcheez's agencies?
He called me fat. :mad:Quote:
Originally Posted by XSquared
But you are... :p
Some background for 'ya, squawktheelf,
Standard C++ includes 51 function libraries which are "pointed-to" by including the associated header file. For example, you can add, subtract multiply, and divide without any headers, but if you want to perform a square-root, you #include <cmath> which has the sqrt() function. And, <ctime> has functions (and other stuff) for working with dates & times, etc.
Most compilers will have additional non-standard headers.
You might be a programmer if... You always start counting at zero! :DQuote:
They have zero posts, and yet, there is one...
and he resigned...Quote:
Originally Posted by Krak