C++初级小程序知多少,你能找到多少是多少

时间:2014-06-22 21:51:54   收藏:0   阅读:280
</pre><pre name="code" class="cpp"><pre name="code" class="cpp">//cin 与 cin.get()之间的区别
//cin读取时忽略空格或是换行符
//cin.get()则是检测那些空格,制表符和换行符
#include <iostream>
//#include <cstdio>
int main()
{
	using namespace std;
	cout<<"Plase enter the sentence : "<<endl;
	char ch;
	int count=0;

//	cin>>ch;

	cin.get(ch);//ch=cin.get();

	while(ch!='#')
	{
		putchar(ch);
		//cout.put(ch);
		//cout<<ch;
		++count;

		//cin>>ch;//get the next char
		ch=getchar();//c
		//ch=cin.get();//cin.get(ch);
	}
	cout<<endl<<count<<" is here."<<endl;
	return 0;
}





C++初级小程序知多少,你能找到多少是多少,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!