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:

For more Practice: Solve these Related Problems:
- Write a C++ program to print a welcome message using multiple escape sequences so that each word appears on a separate line.
- Write a C++ program that constructs the welcome text dynamically and prints it on separate lines using a loop.
- Write a C++ program to store a welcome message in a character array and print it with embedded newline characters.
- Write a C++ program to print a welcome message where the first and last parts are printed using different cout statements, each on a new line.
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?