笔记
m0_58629119
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
全局变量和成员变量
#includeusing namespace std;class Test {public : int a; int b;public : Test(int a = 0, int b = 0) { this->a = a; this->b = b; }public: Test TestAdd1(Test& t2) { Test tmp(this->a + t2.a, this->b + t2.b); return tmp; } Test& Te原创 2023-01-01 20:15:52 · 645 阅读 · 0 评论 -
find : //
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;void A() { //string file("test.txt.zip"); //FILE* fout = fopen(file.c_str(), "w"); //size_t pos = file.rfind('.'); //if (pos != string::npos) { // //string suf = file.substr(pos,原创 2022-12-30 19:26:45 · 219 阅读 · 0 评论 -
string 找find
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;void A() { string file("test.txt.zip"); FILE* fout = fopen(file.c_str(), "w"); size_t pos = file.rfind('.'); if (pos != string::npos) { //string suf = file.substr(pos, file.size(翻译 2022-12-30 18:36:57 · 104 阅读 · 0 评论 -
够造函数循序
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;class A {public : A() { cout翻译 2022-11-30 19:52:52 · 98 阅读 · 0 评论 -
宁明对象 A a; a=g();就是要析构函数
调用析构函数原创 2022-11-18 15:48:24 · 225 阅读 · 0 评论 -
左右值的问题
#includeusing namespace std;void func(int a, int b, int=0) {//右边一定要有个数字,左边默认没有关系 cout原创 2022-11-12 21:04:56 · 122 阅读 · 0 评论 -
C++ static
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;//int geta() {// int a=10;// return a;//}//int&geta1() {// static int a = 12;// return a;//}//int* geta2() {// static int a = 6;// return &a;//}//int main() {// int a1 =原创 2022-10-25 19:51:50 · 380 阅读 · 0 评论 -
【无标题】
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;int main() { int b = 2; int a = 1; const int* p = &a; p = &b;//可以指向别的地址 int* const p1 = &a; *p1 = 5;//可以指向别空间 cout原创 2022-10-15 20:34:28 · 231 阅读 · 0 评论 -
namespace A 命名空间
#include"iostream"using namespace std;namespace A{ int a = 1; namespace B { int a = 2; namespace C { int a = 3; namespace D { int a = 4; } } } }int main() { using namespace A; using namespace B; using namespace C; using names原创 2022-10-11 19:40:30 · 203 阅读 · 0 评论 -
Date operator
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;class Date{public: Date(int year=1900, int month=2, int day=0) { this->_year = year; this->_month = month; this->_day = day; } bool operator==(const Date& d) { if (_year >原创 2022-10-09 22:21:07 · 217 阅读 · 0 评论 -
栈表应用c语言
#include"Stack.h"void tee() { St t; StackInit(&t); StackPush(&t, 1); StackPush(&t, 2); while (!StackEmpty(&t)) { printf("%d ", StackTop(&t)); StackPop(&t); } StackDestory(&t);}int main() { tee(); return 0;}原创 2022-10-01 09:17:38 · 784 阅读 · 0 评论 -
双链表带头
#include"List.h"void test() { LTNode* plist = ListInit(); ListPushBack(plist,1); ListPushBack(plist,2); ListPushBack(plist,3); ListPushBack(plist,4); ListPrint(plist); ListPopBack(plist); ListPopBack(plist); ListPopBack(plist);翻译 2022-09-26 21:26:08 · 104 阅读 · 0 评论 -
头节点单链表
#include"SList.h"#include一般增加才有的节点才会用newnode,看push的话就直接newnode,删的话就不用增加newnode看到POP的带有*都要free,要分tail头和tail ->nextSLTNode* BuyListNode(SLTDateType x) { SLTNode* newnode = (SLTNode*)malloc(sizeof(SLTNode)); if (newnode == NULL) { printf("ov原创 2022-09-26 14:28:17 · 107 阅读 · 0 评论 -
半完成的头单链表
#include"SList.h"void Test() { SLTNode* plist = NULL;//外部plist头指针对接**plist SListPushBack(&plist,1); SListPushBack(&plist, 2); SListPushBack(&plist, 3); SListPushBack(&plist, 4); SListPrint(plist); SListPushFront(&plist,1); SListPushFront(原创 2022-09-25 16:57:55 · 301 阅读 · 0 评论 -
Phead 链表
#include"SList.h"void Test() { SLTNode* plist = NULL;//plist,头指针 SListPushBack(&plist,1); SListPushBack(&plist, 2); SListPushBack(&plist, 3); SListPushBack(&plist, 4); SListPrint(plist);}int main() { Test(); return 0;}原创 2022-09-24 17:57:45 · 284 阅读 · 0 评论 -
顺序表完整得
#include"SeqList.h"void TestSeqList1() { SL sl; SeqListInit(&sl); SeqListPushBack(&sl, 1); SeqListPushBack(&sl, 2); SeqListPushBack(&sl, 3); SeqListPushBack(&sl, 4); SeqListPushBack(&sl, 5); SeqListPrint(&sl); SeqListPushFront(&sl, 10); SeqLis原创 2022-09-24 14:36:37 · 122 阅读 · 0 评论 -
顺序表SeqList 不完整的
#include"SeqList.h"void TestSeqList1() { SL sl; SeqListInit(&sl); SeqListPushBack(&sl, 1); SeqListPushBack(&sl, 2); SeqListPushBack(&sl, 3); SeqListPushBack(&sl, 4); SeqListPushBack(&sl, 5); SeqListPrint(&sl); SeqListPushFront(&sl, 10); SeqLis翻译 2022-09-23 18:09:54 · 126 阅读 · 0 评论 -
fseek
#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#includeint main() { FILE* f = fopen("d:\\t.txt", "w"); if (NULL == f) { perror("fopen"); return -1; } fputc('a', f); fputc('b', f);原创 2022-09-22 09:14:34 · 106 阅读 · 0 评论 -
FSEEK_END FSEEK_CUR FSEEK_SET
#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#includeint main() { FILE* f = fopen("test.txt", "r"); if (f == NULL) { perror("fopen"); return -1; } /*int ch = fgetc(f);*/ char翻译 2022-09-21 20:59:16 · 187 阅读 · 0 评论 -
fread 和fwrite二进制Wb,rb
//int main() {// struct std s = {"xiaodong",19,87.0};// FILE* f = fopen("test03.txt", "wb");// if (f == NULL) {// perror("fopen");// return -1;// }// fwrite(&s,sizeof(s),1,f);// fclose(f);// f = NULL;// system("pause");// return 0;//}int mai翻译 2022-09-21 16:27:06 · 223 阅读 · 0 评论 -
格式化 fscanf和fprintf
fscanf翻译 2022-09-21 15:47:59 · 93 阅读 · 0 评论 -
fgetc 和fputc fgets 和fputs
#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#include//int main() { /*FILE* f = fopen("test.txt", "w");//w对应的是fputc 是字符串 if (NULL == f) { perror("fopen"); return 0; } char ch = '翻译 2022-09-21 15:13:52 · 243 阅读 · 0 评论 -
字符创倒装
#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#include//char* t(char* pbuf) {// int length = strlen(pbuf);// char* p1 = pbuf;// char* p2 = pbuf - 1+length;//这个是后面开始算// while (p翻译 2022-07-19 09:29:30 · 183 阅读 · 0 评论 -
c语言count
#define _CRT_SECURE_NO_WARNINGS#include#include#includeint num(char* p1, char* p2,int *count) { int ret = 0; int tempcount = 0; char* temp = p1; if (p1 == NULL || p2 == NULL || count == NULL) { printf("error"); ret原创 2022-07-11 22:02:27 · 2238 阅读 · 0 评论 -
char buf[128]
char buf[128] = { 'a','b','v' };原创 2022-07-09 21:25:52 · 353 阅读 · 0 评论 -
【无标题】
void bc_sort(int arr[ ],rt){for(int i=0; i<rt-1;i++){for(int j=0;j<rt-1-i;j++){if(arr[j]>arr[j+1]{int temp =arr[j];arr[j]=arr[j+1];arr[j+1]=temp;}}}}void print (int arr[] ,int rt) {for(int i=0; i<rt;i++){printf("%d",arr[i]);}原创 2021-11-22 16:17:44 · 666 阅读 · 0 评论
分享