如何将文本指定为整数 C++?

How to specify text as integer c++?

我是 C++ 编程的新手。我怎样才能做这样的事情?..

int question1;

question1: "What is your name?";

要将文本值设置为整数?

#include <string>
#include <iostream>

int main( )
{
    std::string name;

    std::cout << "What is your name?: " << std::endl;
    std::cin >> name;
    std::cout << "Your Name: " << name << std::endl;
    std::cin.get( );
    return 0;
}

简单地以字符串形式读取输入。