Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 3rd, 2003, 08:47 AM
Authorized User
 
Join Date: Sep 2003
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
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
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
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
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
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





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





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