C++程序代码解析:[10]函数声明
1、#include "PRO.h"//程序目录的相对路悄钸碌灵径中的头文件.#include <iostream>//输入输出头文件.
2、using namespace std;//所有标识符都被定义于一个名为std的namespace中.
3、int main()//主函数
4、float add(float x,float y);//对add函数作声明
5、float a巳呀屋饔,b,c;cout <<"please enter a,b:";//输出cin >>a >>b;//输入a,bc=a颊俄岿髭dd(a,b);//调用函数cout <<"sum=" <<c <<endl;
6、float a蟠校盯昂dd(float x, float y)//定义add函数{float z;z=x+y;return(z);}
7、程序完整源码如下:
8、程序运行结果如下:
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:38
阅读量:23
阅读量:94
阅读量:34
阅读量:25