C++ Exercises: Print a welcome text in a separate line
C++ Basic: Exercise-1 with Solution
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?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/cpp-exercises/basic/cpp-basic-exercise-1.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics