函数声明和使用
#include<iostream>
using namespace std;
int sum(int a,int b);//函数声明
int main()
{
cout << sum(1,2);//函数调用
return 0;
}
int sum(int a,int b)//函数主体
{
return a+b;
}#include<iostream>
using namespace std;
int sum(int a,int b);//函数声明
int main()
{
cout << sum(1,2);//函数调用
return 0;
}
int sum(int a,int b)//函数主体
{
return a+b;
}我第一次接触C++是在2013年,那时候我刚刚学了PHP,其实我是没有打算去学C++的,只是因为随着学的东西越多,发现用C++写的库和项目太多了。学习一下方便学习别人的算法和思想,以便提升自己。 还记得我的...
c++的目标之一是让使用类对象就像使用标准类型一样, 也就是说,常规的初始化语法不适用于类型Stock: int year=2001; struct thing { char *pn; int m; }; thing amabob={"w...
#include <iostream> using namespace std; int main() { if(1+1==2) { cout << "1+1=2"; }...
#include <iostream>using namespace std;int main(){ cout << "Hello, world!...
#include<iostream> using namespace std; void addarr(int *k,int len); //文中形如sizeof(x)/sizeof(x[0]) 是用数组占用空...