26. using namespace

We have already created a namespace Config with two variables:

namespace Config {
    int baudRate = 9600;
    int threshold = 50;
}

Your task is to:

  1. Use the statement using namespace Config; in main().
  2. Print the variables directly (without Config::).
     

The program should print:

Baud: 9600, Threshold: 50

 

Example

Output:

Baud: 9600, Threshold: 50

Why this output?

Because using namespace Config; makes the variables accessible directly.

 

Question Significance

This shows how using namespace imports names into the current scope, so they can be accessed without ::.

Loading...

Input

Expected Output

Baud: 9600, Threshold: 50