#include<iostream.h>
main()
{
char a[10],b[10];
cout<<"what's your name?";
cin>>a[10];
cout<<"what's your favorite color?";
cin>>b[10];
cout<<"my name is "<<a[10]<<" "<<"my favorite color is "<<b[10]<<endl;
}
当输入单个字符是正确。如输入:a 回车 b 回车
输出:my name is a my favorite color is b