LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-02-2004, 11:17 PM   #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-02-2004, 11:20 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
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, 12: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, 01: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, 11:41 AM   #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 11:54 AM.
 
Old 02-03-2004, 11:52 AM   #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



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 05:11 PM
TOS field value lucs Slackware 1 03-31-2005 10:55 AM
set the tos alaios Linux - Networking 4 02-08-2005 06:04 AM
can't find how-tos aron Linux - General 10 12-28-2004 11:58 PM
IP TOS in Linux MajorTux Linux - Networking 2 08-05-2002 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:59 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration