Absolute C++ Chapter 3 Self-Test Exercise(2)

本文提供了多个C语言中函数实现的实例,包括整数求和、判断正负、检查是否有序及验证数字等操作,有助于理解C语言的基本语法和流程控制。

7.Wow

8. 

int sum(int firstNum,int secNum,int thirdNum);
int sum(int firstNum,int secNum,int thirdNum)
{ 
  sumall=firstNum+secNum+thirdNum;
  return sumall
}

9.

char determine(double parameter);
char determine(double parameter)
{
  if(parameter>0)
    return 'P';
  else
    return 'N';
}

10.No

11.You got to include the library when using the predefine the function.

You have to declare before you use the function

12.

bool inOrder(int first,int second, int third)
{
  if((first<=second)&&(second<=third))
    return true;
  else
    return false;
}

13

bool even(int number)
{
  if(number%2==0)
    return true;
  else
    return false;
}
  

14.

bool isDigit(char Letter)
{
  if((Letter>='0')&&
(Letter<='9'))
    return true;
  else
    return false;
}   

转载于:https://www.cnblogs.com/hanterry/archive/2012/05/07/2487370.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值