📄 c11_01.cpp
字号:
//***********************************
//** C11_01.cpp **
// 内联函数声明定义
//***********************************
#include <iostream >
using namespace std;
inline int isnumber(char ch) //内联函数声明并定义
{
return (ch >= '0'&& ch <= '9')? 1 : 0; //如果ch是数字则返回1,否则返回0值
}
int main( )
{
char ch;
while((ch=cin.get()) != '\n') //读入一个字符赋给变量ch,并判断输入是否为回车键
{
if(isnumber(ch)) //调用内联函数isnumber
cout << "the input is a number!\n";
else
cout << " the input is not a number!\n";
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -