LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-03-2004, 12:17 AM   #1
matt3333
Member
 
Registered: Dec 2002
Location: Winnipeg, Manitoba, Canada
Distribution: Slackware
Posts: 371

Rep: Reputation: 30
C++ How-tos


Hey I would like to get into C++ programming i would like to know how everyone else learned such as school certain classes jobs.....Or If anyone learned or knows of a good site for begininers please point me in the right direction!!!!!! Thanx


Matt3333
 
Old 02-03-2004, 12:20 AM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
i gave some links here and others made suggestions also ..
and as of where people learn it in school, it would obviously be a C/C++ course, correct?
i kinda liked the Deitel&Deitel books too for beginners ...
 
Old 02-03-2004, 01:00 AM   #3
matt3333
Member
 
Registered: Dec 2002
Location: Winnipeg, Manitoba, Canada
Distribution: Slackware
Posts: 371

Original Poster
Rep: Reputation: 30
Ok thank-you for the links i have another Very stupid question....How to i run the program eg the oh so famous Hello world:

Code:
// my first program in C++

#include <iostream.h>

int main ()
{
 cout << "Hello World!\n";
 return 0;
}
ok so i wrote that simple thing but it says that i should figure out my compiler before i cont.. So anyone wanna get me a hand with this Thanx!!!!!


Matt3333
 
Old 02-03-2004, 02:04 AM   #4
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
Compile the program source

bash2.05$ gcc my_program.c

Run the program

bash2.05$ ./a.out

You may want to get a new book on C++. Try something published within the last year. Your #include <iostream.h> is technically correct but will throw warnings/errors.
 
Old 02-03-2004, 12:41 PM   #5
opafire
Member
 
Registered: Oct 2003
Location: Colorado Springs
Distribution: Slackware, no more RH or Mandrake for me
Posts: 122

Rep: Reputation: 15
you really should use stl iostream it should look something like this

Code:
#include <iostream>
using namespace std;

int main()
{
   cout << "Hello World!\n";
   return 0;
}
compile and link your program with this command:
'g++ my_program.cpp -o program'

run the program;
./program

Last edited by opafire; 02-03-2004 at 12:54 PM.
 
Old 02-03-2004, 12:52 PM   #6
opafire
Member
 
Registered: Oct 2003
Location: Colorado Springs
Distribution: Slackware, no more RH or Mandrake for me
Posts: 122

Rep: Reputation: 15
stl stands for Standard Template Library.(in case you were wondering)

They're newer than the .h headers, if there is an STL use it rather than the old .h headers.

for example rather than using '#include <string.h>'
you should be using '#include <string>'

Take some classes it will help you a lot more than one of those Sam's teach yourself in 24 hours.

I develop software in C++ where I work. I read the Sam's book, while it gives you a very basic knowledge on how to write small console apps with minimal header files and small classes, you'll still get more out of a class. If you really want to learn C then paying the money for a class is definitely worth it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see TOS with ethereal? Linux.tar.gz Linux - Networking 2 05-31-2005 06:11 PM
TOS field value lucs Slackware 1 03-31-2005 11:55 AM
set the tos alaios Linux - Networking 4 02-08-2005 07:04 AM
can't find how-tos aron Linux - General 10 12-29-2004 12:58 AM
IP TOS in Linux MajorTux Linux - Networking 2 08-05-2002 07:06 AM


All times are GMT -5. The time now is 01:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration