Complete the code to use the standard namespace prefix for cout.
#include <iostream> int main() { [1]::cout << "Hello, world!" << std::endl; return 0; }
The std namespace contains standard library features like cout. Prefixing with std:: accesses them.
Complete the code to bring all standard names into the current scope.
#include <iostream> [1] std; int main() { cout << "Welcome!" << endl; return 0; }
The statement using namespace std; allows using standard library names without the std:: prefix.
Fix the error in the code to correctly use the standard vector.
#include <vector> int main() { std::[1]<int> numbers = {1, 2, 3}; return 0; }
The correct standard container for a dynamic array is std::vector with a lowercase 'v'.
Fill both blanks to define and use a custom namespace with a function call.
#include <iostream> namespace [1] { void greet() { std::cout << "Hi from namespace!" << std::endl; } } int main() { [2]::greet(); return 0; }
The namespace is named custom. To call the function, prefix it with the same namespace name.
Fill all three blanks to create a namespace alias and use it to print a message.
#include <iostream> namespace [1] = std; int main() { [2]::cout << "Alias works!" << [3]; return 0; }
We create an alias s for std. Then use s::cout and end the line with std::endl.