elijah1998's Profile

651
Points

Questions
22

Answers
43

  • Asked on June 7, 2020 in Programming.

    First let’s understand what a namespace is:

    Consider this ,

    There are two students in one classroom having same name for example Vishal. now if we need to differentiate each of them , we would have to use some info along their name like their area of living , physical characteristics etc.

    same goes with namespaces in C++ , you might have a variable named for example value in your C++ program , and there maybe a library which contains a variable named value in it. now there is no way for the compiler to know which version of variable value is being called in the code.

    a namespace is designed to overcome this difficulty and is used as additional information to differentiate similar functions , variables etc. with the same name available in different libraries. Using namespace, you can define the context in which names are defined.

    Now let’s see what namespace std is :

    std is an abbreviation of standard. std is the standard namespace. cout, cin and a lot of other things are defined in it. you can also call these functions using std::cout , std::cin etc.

    What using does :

    The keyword using technically means, use this whenever you can. This refers, in this case, to the std namespace. So whenever the computer comes across cout, cin, endl or anything of that matter, it will read it as std::cout, std::cin or std::endl.

    When you don’t use the std namespace, the computer will try to call cout or cin as if it weren’t defined in a namespace (as most functions in your codes). Since it doesn’t exist there, the computer tries to call something that doesn’t exist! Hence, an error occurs. so essentially , without using namespace std; when you write for example cout << value; you’d have to put std::cout << value;

    Here’s a small example for you:

    #include <iostream>

    int main()

    {

    std::cout << “Hello World”;

    return 0;

    }

     

     

    #include <iostream>

     

    using namespace std; //now you don’t have to write ‘std::’ anymore.

     

    int main()

    {

    cout << “Hello World”;

    return 0;

    }

    • 371 views
    • 1 answers
    • 0 votes
  • Asked on May 18, 2020 in Internet.

    Download this app from google play store.

    U can search by photo through this app

    Click here to downlaod the app

    • 436 views
    • 1 answers
    • 0 votes
  • Asked on April 9, 2020 in YouTube.

    Monetizing your YouTube channel is easy. We’ll walk you through how the program works and how to set-up your account to begin earning revenue from your YouTube videos.

    This means that YouTube places ads inside or near videos. After you’ve enabled monetization on your YouTube channel, your videos can be submitted and approved for monetization. In order to earn the revenue that is generated from these ads, you will need to associate an AdSense account with your YouTube account.

    1. To begin, log in to your YouTube channel account.
    2. In the Channel Settings tab, select “Enable monetization.”
    3. Follow the steps to accept the YouTube monetization agreement.
    4. In the Uploads tab, you will see a green box with a dollar sign next to the videos that are immediately eligible for monetization.
    5. Next, you’ll need to associate an AdSense account to your YouTube channel. It is free to set up a new AdSense account. You will need either a PayPal or a bank account and a valid mailing address in order to have your account verified. AdSense will update you by mail once your account has been approved.

     

    • 349 views
    • 1 answers
    • 0 votes