C++ Program to Print Your Own Name
Last Updated :
04 Jul, 2022
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++
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "Enter the name: " ;
cin >> name;
cout << "Entered name is: " <<
name;
return 0;
}
|
Output:
- Time Complexity: O(1)
- Auxiliary Space: O(1)
Share your thoughts in the comments
Please Login to comment...