|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
weird dev-C++ added code
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||
|
Overclocker
|
when i am programming in dev-C++, i notice that it adds a strange line to the begining for it to work, but its not mentioned in any instructions or anything, here is how the beginning code looks in dev-C++:
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { .... } and this is what i see in the instructions: #include <iostream.h> int main () { .... } is this just a preference by the specific compiler? because i cant run the program without the extra lines. can someone clarify please? thanks!
|
|||||||||||
|
|
|
|
#2 (permalink) | |||||||||||
|
<3 TB303
![]() |
Could you clarify some more? What exactly is the weird line? The extra cstdlib include, or the addition of int argc, char **argv?
__________________
|
|||||||||||
|
|
|
|
#3 (permalink) | |||||||||||
|
Overclocker
|
sry, the line i dont understand is:
using namespace std;
|
|||||||||||
|
|
|
|
#4 (permalink) | ||||||||
|
PC Gamer
|
Well I don't know C++ (planning on starting learning soon).
However, the line #include <cstdlib> allows the use of the functions from the cstdlib library in your code. Those functions can be found here: http://www.cplusplus.com/ref/cstdlib/ For this line: using namespace std;, go here: http://www.steveheller.com/cppad/Output/basics10.html For this line: int main(int argc, char *argv[]), try here: http://publications.gbdirect.co.uk/c...s_to_main.html Basically, those lines are just put in by Dev C++ to make life easier. As a beginner, unless otherwise stated not to have them in the instructions, it should be fine to just keep them in. As i do not C++, I am not completely sure but I hope this helps. Kris EDIT: Oh, it was just namespace you did not understand. Basically it just saves time writing out extra syntax over and over again ![]()
__________________
Kris
|
||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|