#include "stdafx.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char a[100];
gets(a);
cout<<a<<endl;//puts(a) 也行
cout<<endl;
char b[100];
cin.getline(b,sizeof(b));
puts(b);//cout<<b 也行
return 0;
}
博客展示了一段C++代码,包含头文件引入,使用标准命名空间,定义主函数。代码实现了两种输入方式,分别用gets和cin.getline获取用户输入,并通过cout和puts输出内容,最后返回0结束程序。
443
1610

被折叠的 条评论
为什么被折叠?