[C++基础]004_函数

函数的声明方法1:

 1 #include <iostream>
 2 using namespace std;
 3 
 4 int function();
 5 
 6 int main(){
 7     function();
 8     return 0;
 9 }
10 
11 int function(){
12     cout<<"Hello, Function."<<endl;
13     return 0 ;
14 }

函数的声明方法2:

 1 #include <iostream>
 2 using namespace std;
 3 
 4 int function(){
 5     cout<<"Hello, Function."<<endl;
 6     return 0 ;
 7 }
 8 
 9 int main(){
10     function();
11     return 0;
12 }

看出来方法1和方法2的区别了吧,函数体的位置不一样,很简单,复习一下!

posted @ 2012-10-08 23:05  邵贤军  阅读(389)  评论(1编辑  收藏  举报