Press ESC to close

How to Print Your Own Name Using C++

Photo by Markus Spiske

A simple C++ program to print your own name

#include <iostream>
using namespace std;
int main() {
    // Your name goes here
    string myName = "HBSS ACADEMY";
    // Print a friendly greeting with your name
    cout << "Hello, my name is " << myName << "!" << endl;
    return 0;
}

This program includes the necessary #include <iostream> for input and output operations and uses the using namespace std directive to avoid prefixing standard library names with std;. It initializes a string variable myName with your name and prints a friendly greeting to the console. Just replace “HBSS ACADEMY” with your actual name, and you’re good to go!

Leave a Reply

Your email address will not be published. Required fields are marked *