I am trying to learn C++. I created a program that inputs a name and then says "Hello, <name>!". But when I enter "Aditya Singh" as the name, it outputs "Hello, Aditya!", which is not what I expected.
My code:
#include <iostream>
#include <string>
using namespace std;
// I created the class because I was learning C++ Classes
class MyClass {
public: 
    void setName(string inp) {
        name = inp;
    }
    string getName() {
        return name;
    }
private:
    string name;
};
int main() {
    // Input Name
    string inpName;
    cout << "Please enter your name\n";
    cin >> inpName;
    // Say hello
    MyClass name;
    name.setName(inpName);
    cout << "Hello, " << name.getName() << "!" << endl;
}
Does this happen because of a white space in the string? How can I output a string with a white space then?
