Commenting Out Code

Commenting out code

When the code under runs it prints out "Hello world! What a wonderfull place!".

Make it only print"Hello world!" by adding single line comments.

#include <iostream>

int main()
{
	std::cout << "Hello world!";
	std::cout << "What a wonderfull place!";
}

answer

#include <iostream>

int main()
{
	std::cout << "Hello world!";
	// std::cout << "What a wonderfull place!";
}

By using comments we can make the compiler ignore the text. This lets us keep the code in our project without it affecting how our program runs.

Questions