
C++
文章平均质量分 50
个人浅薄笔记
Ryancell
这个作者很懒,什么都没留下…
展开
-
C++ 类和对象 个人笔记
定义对象 class { private: public: }sn;//无类名直接定义对象 基本无用 class student { private: int num; string name; char sex; public: void display() { cout << num; cout << name; cout << sex; } }s1;//声明同时定义对象 student s2;//类名定义对象 class student.原创 2021-03-29 23:33:17 · 375 阅读 · 0 评论 -
C++ string类简介
-string类位于名称空间std中,故 #include <string> 类设计能让程序自动处理string的大小 与数组对象相比,更方便,更安全 赋值操作 string str1 = { "jaguar" };//列表初始化 string str2 = "panther";//C-风格字符串初始化 str1 = str2;//一个string对象赋给另一string对象 cin >> str1;//键盘输入储存 string str3 = str1 + st原创 2021-03-29 22:36:31 · 108 阅读 · 0 评论 -
C++ 链表
#include <iostream> #include <stdlib.h> using namespace std; void menu(struct list*head); struct list*creat_List(struct list* head, int n); struct list*print_List(struct list* head); struct list*del_Node(struct list* head, int n); struct list*i原创 2021-03-29 21:32:36 · 220 阅读 · 0 评论 -
C++零散笔记
Attention!!! 阶乘变化地很快,建议用long或long long型 注意变量类型(全局or局部) abs( )主要用于对求整数的绝对值,在“stdlib.h”(或 )头文件里面。 而fabs( )主要是求精度要求更高的double ,float 型的绝对值,在头文件里。 两者在只#include时都可以使用。 输入字符串 char c; while( (c = getchar() != ' \n' ) ) //字符不能为空格符 输出ASCⅡ码值 int c = getchar(); //g原创 2021-01-23 19:31:40 · 233 阅读 · 0 评论