C++ primer plus Six Edition //2.7.3 答案程序

//2016.08.07
//C++ primer plus Six Edition 
//2.7.3


/*
Write a code of C++,what have three function (include main).
  And generate the following output
  
  Three blind mice
  Three blind mice
  See how they run  
  See how they run
  
  Once function of three need be called twice to output first two line.
  Another need be called twice to output last two line.
*/


#include <iostream>
using namespace std;
void mice(int);
void run(int);


 int main()
 {
 
  int a = 0;
int b = 0;

 
  //
 
  for(a=0;a<2;a++)//mice double
  {
//x = x + 1;
//mice(x);
mice(a);
}
 
 
  for(b=0;b<2;b++)//run double
  {
//y = y + 1;
  //run(y);
run(b);
}
 
  return 0;
 }
 
void mice(int n)//output"Three blind mice"
 {
// int n;
if(n<3)
cout<<"Three blind mice"<<endl;
 }
 
void run(int n)//output"See how they run"
 {
  //int y;
if(n<3)
cout<<"See how they run"<<endl;
 }
 
 /*
  This program test ¡°iostream and call of function¡± 
  I have lots of warn in this program
 
  First every loop need "{}" to definiton loop body; 
 "()"to schedulable condition.
  
    Second variables need to be defined , every variable.

third every function have there own variable

fourth 
*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值