LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices

Reply
 
Search this Thread
Old 05-29-2007, 06:28 AM   #16
irondog
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0

Dont you need to inlude this:

using namespace std;
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 08-25-2007, 12:59 PM   #17
raghunandangp
LQ Newbie
 
Registered: Aug 2007
Location: Birmingham, Alabama
Posts: 1

Rep: Reputation: 0
Lightbulb Thanks

Hay am very new to this Forums. Yes! am very much looking forword to this kind of discussions. Thanks a lot! its very usefull information.
Thanks once again.
 
Old 11-06-2007, 03:05 PM   #18
ctsiow
LQ Newbie
 
Registered: Oct 2007
Location: Isle of Wight, UK
Distribution: Ubuntu 8.10 server - Ubuntu 10.10 Aspire netbook
Posts: 29
Blog Entries: 2

Rep: Reputation: 15
I can only get the second example to work by adding 'using namespace std;' to the code after the two includes. Is this something I have done wrong or an error in the code?

Quote:
#include <iostream>
#include <string>
using namespace std;
int main()

{
string name;
cout << "Type your name: ";
cin >> name;
cout << "Hello " << name << "!\n";
return 0;
}
 
Old 12-12-2007, 10:30 PM   #19
cml21
LQ Newbie
 
Registered: Oct 2007
Location: Detroit
Distribution: Ubuntu 7.04
Posts: 2

Rep: Reputation: 0
Thanks!

Hi Everyone,

Thanks for posting this info. I've done a fair bit of C++ programming, but I'm new to Linux, and was growing tired of sifting thru the Masters level work on g++ (I just wanted to know how to compile!!!). Thanks so much!!!

The example was obviously simple, but the syntax was very useful!

Thanks Again!!!
 
Old 12-13-2008, 12:21 PM   #20
sonypaulpeter
LQ Newbie
 
Registered: Dec 2008
Location: India
Distribution: Ubuntu 8.10 - the intrepid Ibex
Posts: 3

Rep: Reputation: 0
Smile using GEANY for C++ programming

hi,
i am really new to Linux. im using Ubuntu Ultimate 8.10.
i wish to continue using linux instead of windows. i found substitute for almost everything. the normal way of compiling in linux as described in your post is hard for me. i installed 'Geany', it sure does looks good. can you help me in how to use it?. it sure is not the way we use turbo c++ compiler 4.5 rt?. so please help me out
thanks in advance.
 
Old 12-13-2008, 01:00 PM   #21
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,013

Rep: Reputation: 83
Quote:
Originally Posted by irondog View Post
Dont you need to inlude this:

using namespace std;
Yes you do, otherwise the code will fail to compile.

I also thought that using vi(m) in a basic introduction to c++ was an unnecessary complication.

The code could be written in any text editor and vi is not noob friendly.

I always use vi to edit text file in UNIX/Linux but there was not enough space allocated to give a mini "how to" on vi, plus what is the point when there are so many text editors to choose from.

kate or gedit would have been better choices for demonstration purposes, and wouldn't have taken emphasis away from the topic being explained.

Last edited by Disillusionist; 12-13-2008 at 01:04 PM.
 
Old 05-14-2009, 10:40 AM   #22
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 97
Blog Entries: 1

Rep: Reputation: 19
Quote:
Originally Posted by partha6794 View Post
There is a easy method to bulid "C" & "C ++ " programming:

There are three methods to bulid "C" & "C++" programming in RHL 9.0 & FC .by using GNOME desktop & another in KDE .
There are mainly two editor in GNOME , viz. vi- editor & another is emacs editor.I will discuss both here.



using VI-editor:

1. open terminal .
2. type for C programming
vi <filename>.c

for C++
vi <filename>.cpp

e.g:

vi hello.c { for C}
vi hello. cpp { for C++}

3. then type " i" ( i= insert)
4. then write source code . for details www.howstuffworks.com how to works "C" programming?
5. then press
esc : wq
it is save now.

6. now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )

8. then it will see your screen.


USING EMACS EDITOR:

1.type emacs<file name> on terminal.
3. then type " i" ( i= insert)
4. then write source code . for details www.howstuffworks.com how to works "C" programming?
5. then press
esc : wq
it is save now.

6. now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )

8. then it will see your screen.


USING KWRITE IN ( GNOME OR KDE DESKTOP)

1. Open terminal & type kwrite
2. then write source code
3. then click file .
4. then clck save as
5. save the file wtth extension .c/.cpp
now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )


I hope it will helpful .


If you face any diffuculty u can email me
partha_26786794123@yahoo.com , ( for alert reply here)

partha
Use gvim (vim with the GUI) it puts the edit into it's own window and once does not have to exit and reenter as compiles fail (due to typos etc). The best IDE is not not "Intergraded" as the best allows one to use the tools that they think are best. I like to use ddd as the debugger, gvim as the editor, a an xterm as my terminal. Since I never have been a "Microsoft Windows" user, I actually have all of this open and overlapping on the same desktop. I also make use of the (old default which is not longer the defaul) of "focus follows mouse" and "auto raise" so moving the mouse from on window to the other is all that is needed to use the other window. This allows (better tools) to be used for each part of development rather than the average tools that are in an IDE. (Some distros include the gvim product, some have to add it as it is not preselected and some do not include it at all. (Some call it gvim and others might call it vim -X11.)
 
Old 09-24-2009, 02:29 AM   #23
mpirvanescu
LQ Newbie
 
Registered: Sep 2009
Posts: 3

Rep: Reputation: 0
some other tutorial links?

The tutorial becomes great with all these corrections.

Do you know other links for tutorials in c++ programming?

Thank you.
 
Old 06-27-2010, 01:38 PM   #24
slugman
Member
 
Registered: Jun 2010
Location: AZ
Distribution: Slackware
Posts: 69

Rep: Reputation: 1
Cool quick note

Thanks for the tut partha! Exactly what I was looking for. Vi imo is the editor of choice! I know its a little dated, but still very relevant.

Can a mod or someone edit the post to make sure using namespace std; is included? would be nice, though not necessary I suppose.

And do not let Disillusionist fool you! I'm a complete programming noob, but Vi is my swiss army knife! Every noob should learn how to use it--its akin to the sword that grants user more exp and strength by use .

Last edited by slugman; 06-27-2010 at 01:46 PM. Reason: i can't spell
 
Old 06-28-2010, 01:55 AM   #25
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,013

Rep: Reputation: 83
Quote:
Originally Posted by slugman View Post
And do not let Disillusionist fool you! I'm a complete programming noob, but Vi is my swiss army knife! Every noob should learn how to use it--its akin to the sword that grants user more exp and strength by use .
As I stated, I always use vi for text editing in UNIX/Linux. My point was:
Quote:
there was not enough space allocated to give a mini "how to" on vi
As far as writing code goes, the demonstration did not need to state one text editor over another, and vi is not intuitive but rather something that you learn.

I agree that every one should learn how to use vi, but one of the great things about Linux and the Open Source community is the freedom of choice.

You state that you are "a complete programming noob" but that doesn't mean that you are new to Linux. Try to remember when you were first introduced to vi (for me that was about 12 years ago)
 
Old 09-07-2010, 02:12 PM   #26
aahiqmir
Member
 
Registered: Apr 2008
Posts: 54

Rep: Reputation: 15
socket programing in C++ tutorials.

can you tell me where can i find socket programing in C++ tutorials, i am just a beginner.
C will do also but if it is explained very well as i already mentioned i am just a beginner of socket programing.



thank you.
 
Old 09-14-2010, 01:05 AM   #27
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,623
Blog Entries: 29

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by aahiqmir View Post
can you tell me where can i find socket programing in C++ tutorials,
Put following keywords in Google and hit enter:
Quote:
socket programming c++ tutorial Linux
 
Old 10-25-2010, 04:00 AM   #28
amelsayed
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Rep: Reputation: 0
can we move bit forward, can any one discuss how to deal with socket programming under linux !!
 
Old 01-04-2011, 07:26 AM   #29
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 494

Rep: Reputation: 75
Quote:
Originally Posted by cryptowicked View Post
how do you exit out of the edit file? I write the source and then i save it, but how do i exit back into the user shell?
--noob tryin to rtfm--
cryptowicked-
press ESC
then ":wq" (without the quotes, to save and exit)

I would signest to learn how to use vi before learning C++
Save the following file as "vimtutor" and edit it with vi, this will learn you how to use the basic functions of vi
http://www2.geog.ucl.ac.uk/~mdisney/.../unix/vimtutor
 
Old 07-02-2011, 04:22 PM   #30
TheStefan12345
LQ Newbie
 
Registered: Jan 2011
Distribution: Kubuntu 11.04
Posts: 12

Rep: Reputation: 0
I just bought a book, and it doesn't say that you need using namespace std; and you need iostream.h

What the hell?
 
  


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
DISCUSSION: Building C programs on Linux crabboy LinuxAnswers Discussion 29 09-04-2013 11:19 AM
DISCUSSION: Building a Slackware Wireless Access Point eric.r.turner LinuxAnswers Discussion 11 09-09-2006 02:36 AM
DISCUSSION: ssh w/ gtk programs (host-client display export) mrchaos LinuxAnswers Discussion 1 12-14-2005 02:50 PM
DISCUSSION: Compiling Programs from Source jeremy LinuxAnswers Discussion 51 11-21-2005 05:35 AM
DISCUSSION: Virtual Filesystem: Building a Linux Filesystem from an Ordinary File mchirico LinuxAnswers Discussion 0 10-28-2004 11:35 PM


All times are GMT -5. The time now is 02:43 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