63,606
社区成员




#include <iostream>
using namespace std;
int main()
{
int num = 0;
char ch;
cout<<"input a number num="<<endl;
cin>>num;
ch = getchar();
cout<<"inputed number is"<<num<<endl;
cout<<"input character is"<<ch<<endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout <<"please input two numbers" <<endl;
int num1,num2,max,min,count=0;
//输出num1,num2
cout <<"before input current num is:" <<num1 <<" " <<num2 <<endl;
cin>> num1>> num2;
cout <<"after input current num is:" <<num1 <<" " <<num2 <<endl;
fflush(stdin);
getchar();//暂停一下(如果输入的不是两个规范数,比如说是字母,在这里不会停顿)
//判断输入的两个数的大小
if(num1>=num2)
{
max=num1;
min=num2;
}
else
{
max=num2;
min=num1;
}
//按每行不超过十个数来输出给定的两个数之间的数
for(int i=min;i <=max;i++,count++)
{
if(count!=0&&count%10==0)
{
cout <<endl;
count=0;
}
cout <<i <<" ";
}
getchar();
return 0;
}