Resolve Driver Collision

#include <iostream>
using namespace std;

// Create namespaces DriverA and DriverB here
namespace DriverA
{
    void init()
    {
        std::cout << "A INIT" << std::endl;
    }
}

namespace DriverB
{
    void init()
    {
        std::cout << "B INIT" << std::endl;
    }
}

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

    // Call correct namespace function here
    if (x == 1)
    {
        DriverA::init();
    }
    else if (x == 2)
    {
        DriverB::init();
    }
    return 0;
}

Solving Approach

 

 

 

 

Upvote
Downvote
Loading...

Input

1

Expected Output

A INIT