std in C++ code example

Example 1: using namespace std in c++

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World";
    system("pause");
    return 0;
    
}

Example 2: strcmp c++

#include<stdio.h> 
#include<string.h> 


int main() 
{  
      
    char char1[] = "coucou"; 
    char char2[] = "coucou"; 
      
  	if( strcmp(char1, char2) == 0 )
       printf("Strings are the same");
  
  	else
      prinf("Strings are differentes");
  
  
    return 0; 
}

Example 3: using std c++

using namespace std;

Example 4: why to use std:: in c++

When you are using "std::" it means that you will grap the following command
from the "std" namespace.
The std namespace is an abbreviation for standard

If you use "std::" you hvae to include "#include <iostream>"

Tags:

Cpp Example