Basic Input and Output in C++

This C++ snippet demonstrates a fundamental operation by accepting user input and presenting personalized greetings without delving into advanced concepts.

Basic Input and Output in C++
Photo by Kari Shea / Unsplash

This C++ snippet demonstrates a fundamental operation by accepting user input and presenting personalized greetings without delving into advanced concepts.

#include <iostream>
#include <string>

int main() {
    std::string name;
    std::cout << "Enter your name: ";
    std::cin >> name;
    std::cout << "Hello, " << name << "!" << std::endl;
    return 0;
}