The Wayback Machine - https://web.archive.org/web/20221221172321/https://www.geeksforgeeks.org/cpp-program-to-print-your-own-name/
Skip to content
Related Articles

Related Articles

C++ Program to Print Your Own Name

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 04 Jul, 2022
Improve Article
Save Article

Here, we will see how to input a name and print it as the output using a C++ program. Below are the examples:

Input: GeeksforGeeks
Output: GeeksforGeeks

Input: Alex
Output: Alex

Below is the C++ program to print the name as output:

C++




// C++ program to print name
// as output
#include <iostream>
using namespace std;
  
// Driver code
int main()
{
  string name;
      
  cout << "Enter the name: ";
  cin >> name;
    
  cout << "Entered name is: " << 
           name; 
    return 0;
}

Output:

C++ program to print name

 

  • Time Complexity: O(1)
  • Auxiliary Space: O(1)
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!