C++为什么int age=-1赋值不出来

int main()
{
cout << "please enter your first_name and age:\n";

string first_name="clownlong";

int age = -1;

cin >> first_name >> age;

cout << "Hello," << first_name <<"(age"<<age<<")\n";

}
这个测试的时候我 为什么他的age初始值不是-1,总是0这是什么原因。看不懂文字请看图片!本人小白 刚学没多久所以很多不懂!图片说明

你输入反了,第一个是名字,第二个是年龄

图片说明

你的输出的确很奇怪
用我的程序

// Q769041.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream>
#include <string>
using namespace std;

int main()
{
    cout << "please enter your first_name and age:\n";
    string first_name="clownlong";

    int age = -1;

    cin >> first_name >> age;

    cout << "Hello," << first_name <<"(age"<<age<<")\n";
    return 0;
}

在VC2010上,结果是-1

图片说明

是不是你输入的是全角的空格或者你程序有别的问题,或者你运行的不是你源代码的那个版本的程序。要么就是你环境有什么问题

把cin >> first_name >> age;
改成 cin >> age>> first_name;