摘要: 比较:① cin和>>来进行输入:要求用户通过按下回车来提示程序的输入已经完成,即使单个字符也是如此。② getche()可以实现:当用户敲入每一个字符的时候立即进行处理,而不用等待回车键。这个函数没有参数,要求包含conio.h头文件。注意:getche()会将字符显示在屏幕上;而各getch()不会将字符显示在屏幕上。就类似linux在输入密码的时候屏幕上什么反应也没有,但实际上已经输入进去了。#include<iostream>using namespace std;#include<conio.h>int main(){int chcount=0;i 阅读全文
posted @ 2011-06-30 17:20 csqlwy 阅读(527) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;int main(){ int a,b;char c;cout<<"Enter a number:";cin>>a; for(b=2;b<=a/2;b++) if(a%b==0) { cout<<"the number is not a prime!"<<endl<<"第一个除数 is:"<<b<<endl;exit(0); } cout<<&qu 阅读全文
posted @ 2011-06-30 11:23 csqlwy 阅读(319) 评论(0) 推荐(0) 编辑