函数基本知识
要使用C++函数,必须要完成如下工作:
- 提供函数定义
- 提供函数原型
- 调用函数
#include<iostream>
void simple(); //函数原型
int main(){
using namespace std;
simple(); //调用函数
}
void simple(){ //函数定义
using namespace std;
cout << "simple fuction" << endl;
}
#include<iostream>
void simple(); //函数原型
int main(){
using namespace std;
simple(); //调用函数
}
void simple(){ //函数定义
using namespace std;
cout << "simple fuction" << endl;
}