标准输入流

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main()
{
	cout << "first call" << cin.get() << endl;
	char ch;
	cin.get(ch);
	cout << "second call" << ch << endl;
	char str[10];
	cin.get(str, 8, 'T');
	cout << "third call" << str << endl;
	system("pause");
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main()
{
	int line, max = 0;
	char str1[100], str2[100];
	cout << "please input some strings:" << endl;
	while (cin.getline(str1, 100))
	{
		line = cin.gcount();
		if (line > max)
		{
			max = line;
			strcpy(str2, str1);
		}
	}
	cout << endl;
	cout << str2 << endl;
	cout << max << endl;
	system("pause");
	return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
_mos_:要不是看评论区我都不知道你要找的是数分
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务