Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 12.2, Problem 13STE

Explanation of Solution

Program:

//Header file

#include <iostream>

//For standard input and output

using namespace std;

//Create namespace "sally"

namespace sally

{

//Function declaration for message()

 void message( );

}

//Create unnamed namespace

namespace

{

 //Function declaration for message()

 void message( );

}

//Main function

int main( )

{

 {

/* Call the message() function for unnamed namespace */

  message( );

/* Call the function message() by "using" directive */

  using sally::message;

  //Call message() function

  message( );

 }

/* Call the message() function for unnamed namespace */

  message( );

 return 0;

}

/* Create function definition of namespace for "message()" function */

namespace sally

{

 /* Function definition for message() */

 void message( )

 {

   /* Display message */

 cout << "Hello from Sally.\n";

 }

}

/* Create function definition of unnamed namespace for "message()" function */

namespace

{

 void message( )

 {

   /* Display message */

 cout << "Hello from unnamed.\n";

 }

}

Explanation:

The given code is used to display the message from “sally” namespace and unnamed namespace...

Blurred answer
Students have asked these similar questions
C++ - No library functions like atoi Write a machine language program to output your first name on the output device. Submit your "machine code" followed by a 'zz.' An example of the machine code to output "hello" is shown below. This is an example of what a machine language submission would look like: 50 00 48 50 00 65 50 00 6c 50 00 6c 50 00 6f 00 zz
Complete the following code and then generate an equivalent code in python.
Convert to Codechum C++
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,