c++之函数的调用
2016-04-05 17:27
232 查看
#include<iostream>
#include<math.h>
using namespace std;
void output(double light_year,double astronomical_units);
int main()
{
double light_year;
double astronomical_units;
cout<<"Enter the number of light years : ";
cin>>light_year;
output(light_year,astronomical_units);//函数的调用必须见参数填入,可以不填参数类型,否则报错
cout<<light_year<<" light years = "<<astronomical_units<<" astronomical units "<<endl;
}
void output(double light_year,double astronomical_units)
{
astronomical_units=light_year*63240;
}
#include<math.h>
using namespace std;
void output(double light_year,double astronomical_units);
int main()
{
double light_year;
double astronomical_units;
cout<<"Enter the number of light years : ";
cin>>light_year;
output(light_year,astronomical_units);//函数的调用必须见参数填入,可以不填参数类型,否则报错
cout<<light_year<<" light years = "<<astronomical_units<<" astronomical units "<<endl;
}
void output(double light_year,double astronomical_units)
{
astronomical_units=light_year*63240;
}
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- 关于指针的一些事情
- c++ primer 第五版 笔记前言
- share_ptr的几个注意点
- Mootools 1.2教程 函数
- autoit InputBox 函数
- 文件遍历排序函数
- Oracle 函数大全[字符串函数,数学函数,日期函数]第1/4页
- ASP下经常用的字符串等函数参考资料
- PostgreSQL教程(五):函数和操作符详解(1)
- DOS批处理 函数定义与用法
- asp Chr 函数 数字转字母的方法
- Lua中的函数精讲笔记
- Lua中的闭合函数、非全局函数与函数的尾调用详解
- Lua中调用C++函数示例
- Lua实现split函数
- Lua常用时间函数使用实例
- Lua函数与字符串处理简明总结
- Lua教程(一):在C++中嵌入Lua脚本