f0603.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:

C#编程

开发平台:

Visual C++

  1. //=====================================
  2. // f0603.cpp
  3. // 内联函数
  4. //=====================================
  5. #include<iostream>
  6. using namespace std;
  7. //-------------------------------------
  8. inline bool isnumber(char);    // 内联声明
  9. //-------------------------------------
  10. int main(){
  11.   for(char c; cin>>c && c!='n'; )
  12.     if(isnumber(c)) cout<<"you entered a digit.n";
  13.     else cout<<"you entered a non-digit.n";
  14. }//------------------------------------
  15. bool isnumber(char ch){
  16.   return ch>='0' && ch<='9' ? 1 : 0;
  17. }//====================================
  18.