字符串输入输出cin.get的用法

#include "stdafx.h"
#include "iostream"
#include "windows.h"
#include "string"
#include "cstring"

using namespace std;

int main(int argc, char* argv[])
{
	char name[21],ch[21];
	int age;
	cout<<"Please enter your name : \n";
	cin.get(name,20).get();
	cout<<"Please enter your mother's name : \n";
	cin.get(ch,20);
	cout<<"Please enter your age : \n";
	cin>>age;
	cout<<"Your name is "<<name<<" Your mother's name is "<<ch<<" your age is "<<age<<endl;
	system("pause");
	return 0;
}

你可能感兴趣的:(字符串输入输出cin.get的用法)