很长时间没用vc了,今天随便写了一个小程序,回忆一下c++的语法,程序如下:
#include<iostream>
#include<stdio.h>
using namespace std;void main()
{
char a[5];
char b[5];
   
cout<<"please input the content of a:"<<endl;
cin>>a;

cout<<"a="<<a<<endl;

cout<<"please input the content of b:"<<endl;
cin>>b; cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
}然后输入和运行结果如下:
please input the content of a:
avvvvvvv
a=avvvvvvv
please input the content of b:
btttttttt
a=t
b=btttttttt问题:在输入串b之前和之后显示的串a的内容是不同的,为什么?