Resolve UART Namespaces

#include <iostream>
using namespace std;

// Create namespace Boot with nested namespace UART
namespace Boot{
    namespace Uart{
        void send(){
            cout<<"BOOT UART\n";
        }
    }
}
// Create namespace App  with nested namespace UART
namespace App{
    namespace Uart{
        void send(){
            cout<<"APP UART\n";
        }
    }
}

int main() {
    int mode;
    cin >> mode;

    // Call correct send() function here
    if(mode==1){
        Boot::Uart::send();
    }
    else{
        App::Uart::send();
    }


    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

1

Expected Output

BOOT UART