C++ Exercises: Print a welcome text in a separate line
Welcome Text on Separate Line
Write a program in C++ to print welcome text on a separate line.
Visual Presentation:
Sample Solution:
C++ Code :
#include <iostream> // Including the input-output stream header file
using namespace std; // Using the standard namespace
int main() // Start of the main function
{
cout << "\n\n Print a welcome text in a separate line :\n"; // Outputting a welcome message with newlines
cout << "----------------------------------------------\n"; // Outputting a separator line
cout << " Welcome to \n" ; // Outputting a welcome message in a new line
cout << " w3resource.com "<<endl ; // Outputting the website address and ending the line
} // End of the main function
Sample Output:
Print a welcome text in a separate line : ---------------------------------------------- Welcome to w3resource.com
Flowchart:
C++ Code Editor:
Previous: C++ Basic Exercises Home
Next: Write a program in C++ to print the sum of two numbers.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics