Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 3rd, 2003, 08:47 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default total beginner question

I just want a space between first_name and last_name when this output's

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

{

   char first_name[15];
   char last_name[15];
   cout << "Please enter your first name \n";
   cin >> first_name;
   cout << "Please enter your last name \n";
   cin >> last_name;
   cout << "Hello " << first_name << last_name << endl;

   return 0;

}

Just learning...Thanks!!!! Kevin

Reply With Quote
  #2 (permalink)  
Old October 3rd, 2003, 09:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

how about this:
cout << "Hello " << first_name << " " << last_name << endl;
Reply With Quote
  #3 (permalink)  
Old October 3rd, 2003, 06:36 PM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks pgtips!

Reply With Quote
  #4 (permalink)  
Old October 15th, 2003, 07:26 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What does the namespace std code do?

Reply With Quote
  #5 (permalink)  
Old November 3rd, 2003, 09:01 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to uponline_aom
Default

C# ?

Reply With Quote
  #6 (permalink)  
Old November 3rd, 2003, 11:00 PM
Registered User
 
Join Date: Aug 2003
Location: Houston, Texas, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

>> What does the namespace std code do?

Namespaces prevent name clashes. So say you have a 'strcpy' function that takes the same arguments as the standard library's. Just wrap yours up in a custom namespace and - voila - an extra scoping facility, basically. There are three basic ways to use code from another namespace.

1) using namespace fumanchu;

That simply allows you to use any function from 'fumanchu::' without specifying it explicitly with the scope-resolution operator.

2) using fumanchu::strcpy;

That allows you to use that *one* function without the scope-resolution operator.

3) fumanchu::strcpy(str, "foo");

If either (1) or (2) were not done, this is how you must access any code from 'fumanchu::'. Explicitly.

"The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." - Donald Knuth
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xslt beginner question cfflexguy XSLT 4 October 16th, 2007 09:11 AM
Beginner Question dkr72 Excel VBA 1 January 18th, 2005 09:37 AM
Beginner question on getting only certain elements EstherMStrom XSLT 5 December 10th, 2004 04:38 PM
beginner question saudyonline General .NET 2 September 21st, 2004 01:56 AM



All times are GMT -4. The time now is 08:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.