Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 06-23-05   #1 (permalink)
Overclocker
 
Jonrezz's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: croton on hudson NY
Posts: 646

Rep: 40 Jonrezz is acknowledged by some
Unique Rep: 36
FAQs Submitted: 1
Folding Team Rank: 2238
Hardware Reviews: 1
Trader Rating: 0
Default weird dev-C++ added code

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!

System: laptop
CPU
c2d t7200
Motherboard
sony laptop
Memory
2 gb ddr2
Graphics Card
7400 (best i could find for 13")
Hard Drive
160 gb 5400 rpm
Sound Card
integrated
Power Supply
sony laptop
Case
SZ model
OS
vista buisness
Monitor
13.3" glossy kind
Jonrezz is offline I fold for Overclock.net   Reply With Quote
Old 06-23-05   #2 (permalink)
<3 TB303
 
Xaimus's Avatar
 
amd nvidia

Join Date: Dec 2004
Location: Manhattan, KS
Posts: 575

Trader Rating: 0
Default

Could you clarify some more? What exactly is the weird line? The extra cstdlib include, or the addition of int argc, char **argv?
__________________
System: Turd
CPU
Sempron 2800+ :(
Motherboard
GA7NF-RZ :(
Memory
1.25GB
Graphics Card
geForce 6800XT
Hard Drive
80GB + 120GB
Sound Card
M-Audio Audiophile 192 :D
Power Supply
500W Seasonic S12
Case
Black Antec P180 :D
OS
FreeBSD 6.2-RELEASE :D :D
Monitor
Two 17" CRTs
Xaimus is offline Overclocked Account   Reply With Quote
Old 06-23-05   #3 (permalink)
Overclocker
 
Jonrezz's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: croton on hudson NY
Posts: 646

Rep: 40 Jonrezz is acknowledged by some
Unique Rep: 36
FAQs Submitted: 1
Folding Team Rank: 2238
Hardware Reviews: 1
Trader Rating: 0
Default

sry, the line i dont understand is:

using namespace std;

System: laptop
CPU
c2d t7200
Motherboard
sony laptop
Memory
2 gb ddr2
Graphics Card
7400 (best i could find for 13")
Hard Drive
160 gb 5400 rpm
Sound Card
integrated
Power Supply
sony laptop
Case
SZ model
OS
vista buisness
Monitor
13.3" glossy kind
Jonrezz is offline I fold for Overclock.net   Reply With Quote
Old 06-23-05   #4 (permalink)
PC Gamer
 
kris_cs1's Avatar
 
amd ati

Join Date: Apr 2005
Location: Chester, Cheshire
Posts: 218

Rep: 27 kris_cs1 is acknowledged by some
Unique Rep: 24
FAQs Submitted: 1
Trader Rating: 0
Default

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



System: My System
CPU
AMD Sempron 2800+
Motherboard
ASUS A7N8X-VM
Sound Card
5.1 SURROUND SOUND
Power Supply
350W
Case
Black
OS
Windows XP Home SP2
Monitor
19"
kris_cs1 is offline   Reply With Quote
Old 06-23-05   #5 (permalink)
Overclocker
 
Jonrezz's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: croton on hudson NY
Posts: 646

Rep: 40 Jonrezz is acknowledged by some
Unique Rep: 36
FAQs Submitted: 1
Folding Team Rank: 2238
Hardware Reviews: 1
Trader Rating: 0
Default

ok thanks!

System: laptop
CPU
c2d t7200
Motherboard
sony laptop
Memory
2 gb ddr2
Graphics Card
7400 (best i could find for 13")
Hard Drive
160 gb 5400 rpm
Sound Card
integrated
Power Supply
sony laptop
Case
SZ model
OS
vista buisness
Monitor
13.3" glossy kind
Jonrezz is offline I fold for Overclock.net   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 07:52 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.23955 seconds with 8 queries