摘要:
先将关于函数的默认参数一些要点总结如下: 1.如果同时有函数的声明和定义 我们要把对于函数的默认参数加在函数的声明之中,而不能放在函数的定义中。 int add(int a, int b, int c=5); int main(void) { cout << add(2, 3); } int add 阅读全文
摘要:
最近开始学习了类,rock老师告诉我说,以往的编程是面向过程的,从今以后 就要开始面向对象进行编程了。 首先 关于定义一个Human对象 class Human { public : //共有的对外的方法 Human();//手动自定义的默认构造函数 Human(string name,int ag 阅读全文
摘要:
举个例子: #include <iostream>#include <Windows.h>#include <string>using namespace std; int main (void){ int i = 0; string ret; for(int i = 0;i < 5; i++){ 阅读全文