上一页 1 ··· 110 111 112 113 114 115 116 117 118 ··· 164 下一页
摘要: 在C语言中,goto是一条无条件跳转语句,它允许程序控制流跳转到同一函数内的某个特定标签处继续执行。使用goto语句时,需要在目标位置定义一个标签,标签由一个标识符后跟一个冒号(:)组成 #include <iostream> using namespace std; void func(bool 阅读全文
posted @ 2020-08-12 07:50 天子骄龙 阅读(279) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; class Student { public: Student(const string& name1, int age1, int no1) { name = name1; age 阅读全文
posted @ 2020-08-12 07:20 天子骄龙 阅读(938) 评论(0) 推荐(0)
摘要: C++ 标准库没有提供所谓的日期类型。C++ 继承了 C 语言用于日期和时间操作的结构和函数。为了使用日期和时间相关的函数和结构,需要在 C++ 程序中引用 <ctime> 头文件 time.h 头文件定义了四个变量类型、两个宏 四个变量类型: size_t是无符号整数类型,它是 sizeof 关键 阅读全文
posted @ 2020-08-11 13:57 天子骄龙 阅读(1739) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; class Student { /* 构造函数语法:类名(参数表){ } 注意:函数名与类名相同,没有返回值 构造函数在创建对象时,会自动执行,主要用来初始化 */ public: 阅读全文
posted @ 2020-08-11 13:18 天子骄龙 阅读(273) 评论(0) 推荐(0)
摘要: 定义类的格式: class 类名:继承方式 基类,......{ } #include <iostream> #include <string> using namespace std; class Student { //类默认都是私有的 //成员 private: string name; pu 阅读全文
posted @ 2020-08-11 11:38 天子骄龙 阅读(322) 评论(0) 推荐(0)
摘要: public:公有 任何位置都可以访问 private:私有成员 只有类自己的成员函数才能访问 protected: 保护成员 只有类自己和子类的成员函数才能访问 阅读全文
posted @ 2020-08-11 08:44 天子骄龙 阅读(276) 评论(0) 推荐(0)
摘要: 隐试类型转换: char c = 'A'; int x = c; //隐试类型转换 cout << x << endl; 显式类型转换: //强制类型转换 char c = 'A'; int x = (int)c; //C风格 int y = int(c);//C++风格 C++扩展了四种操作符形式 阅读全文
posted @ 2020-08-10 10:17 天子骄龙 阅读(175) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; inline int add(int a, int b = 10) { //inline 内联函数--可以提高执行效率 //内联函数和普通函数的区别在于:当编译器处理调用内联函数的语句时,不会将该语句编译成函数调用的指 阅读全文
posted @ 2020-08-07 18:35 天子骄龙 阅读(127) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int add(int a, int b = 10) { //b=10 缺省参数,缺省参数必须在右侧 //如果函数的声明和定义分开写,缺省参数只需写在声明部分就行,定义部分就不需要写了 return a + b; } 阅读全文
posted @ 2020-08-06 20:01 天子骄龙 阅读(745) 评论(0) 推荐(0)
摘要: 安装:pip install pymunk 阅读全文
posted @ 2020-08-05 11:28 天子骄龙 阅读(731) 评论(0) 推荐(0)
上一页 1 ··· 110 111 112 113 114 115 116 117 118 ··· 164 下一页