自訂函式:
1. hello()
2. myPlus(int x,int y,int z)- #include<iostream>
- #include<cstdlib>
- using namespace std;
- void hello()
- {
- cout<<"HELLO!!"<<endl;
- }
- int myPlus(int x,int y,int z)
- {
- return x+y+z;
- }
- int main()
- {
- hello();
- cout<<myPlus(2,5,1)<<endl;
- system("pause");
- return 0;
- }
複製代碼- #include<iostream>
- #include<cstdlib>
- using namespace std;
- void hello();
- int myPlus(int,int,int);
- int main()
- {
- hello();
- cout<<myPlus(2,5,1)<<endl;
- system("pause");
- return 0;
- }
- void hello()
- {
- cout<<"HELLO!!"<<endl;
- }
- int myPlus(int x,int y,int z)
- {
- return x+y+z;
- }
複製代碼 |