关于cin无法把回车送到输入流的问题

cin 输入默认情况下是忽略 回车,空格,tab等空白符。为了使之不忽略可以 设置  cin.unsetf(ios::skipws);
ios::skipws -- Skip white space. 跳过空白(空格,表格键。。。。)
unsetf(。。。) -- 取消。。。格式 设置

cin.unsetf(ios::skipws); -- 取消 cin 输入 跳过空白 的 默认 设置
 
  
题目:
输入一串数,以','分隔,输出所有数中去掉最大值、最小值之后剩下的个数。(其中最大值与最小值可能有多个)
Smple input:3,3,5,3,6,9,7,9   Sample outPut: 3
#include 
#define  N 100
using namespace std;

void main()
{

	int a[N],n=0 ,temp,min=10,max=0;
	char c='0';
	while(c!='\n')
	{
		//scanf("%d",&temp);
		cin >> temp;
		a[n]=temp;
		if(temp>max) max=temp;
		if(temp> c;
		//scanf("%c",&c);
		cin.unsetf(ios::skipws);
		cin >> c;
	}

	temp=0;
	for (int i=0;imin) temp++;
	}
	cout << temp << endl;
}


你可能感兴趣的:(关于cin无法把回车送到输入流的问题)