C++ primer plus Six Edition //2.7.3 答案程序
来源:互联网 发布:淘宝直播卖家申请入口 编辑:程序博客网 时间:2024/06/07 10:56
//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
*/
//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
- C++ primer plus Six Edition //2.7.3 答案程序
- C++ Primer Plus (Six Edition) Chapter 3, Review
- C++ Primer Plus (Six Edition) Chapter 3, Programming Exercises
- C++ Primer Plus (Six Edition) Chapter 2, Review
- C++ Primer Plus (Six Edition) Chapter 2, Programming Exercises
- C++ Primer Plus (Six Edition) Chapter 4, Review
- C++ Primer Plus (Six Edition) Chapter 4, Review
- c primer plus 12.11答案
- C Primer Plus Fifth Edition 笔记chapter1
- C Primer Plus Fifth Edition 笔记chapter2
- C Primer Plus (5th Edition)
- C++primer plus第六版课后编程练习答案2.7
- C++Primer Plus第六版中文答案 4.13.3
- 第六章答案 c primer plus
- C Primer Plus(2-12章)答案
- C Primer Plus(13-17章)答案
- c primer plus 第九章 答案
- c primer plus 第八章答案
- MAVEN安装、并在Myeclipse下,装配本地仓库以及建web项目并在tomcat下运行完整过程笔记
- [Lintcode]Backpack
- 数列上的分治(求逆序数)
- Hibernate一对多条件查询
- ToLua#--lua调用C#泛型结构以及遍历
- C++ primer plus Six Edition //2.7.3 答案程序
- org.xml.sax.SAXParseException
- redis3.0 集群安装详细步骤
- Java 容器集合框架概览
- Maltab R2015b win32安装之路
- 浅谈Android五大布局——LinearLayout、FrameLayout和AbsoulteLayout
- Eclipse中的java、xml代码提示功能设置
- Required Device Capabilities
- Android 热修复总结