自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(53)
  • 收藏
  • 关注

翻译 operator 运算符

#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;//namespace j//{// class string// {// friend ostream& operator

2023-01-15 17:38:41 96

原创 全局变量和成员变量

#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 606

原创 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 183

翻译 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 66

翻译 够造函数循序

#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;class A {public : A() { cout

2022-11-30 19:52:52 63

原创 宁明对象 A a; a=g();就是要析构函数

调用析构函数

2022-11-18 15:48:24 190

原创 模板template

#includeusing namespace std;templateT2 Add(T1 t1, T2 t2) { return t1 + t2;};templateT2 Sub(T1 t1, T2 t2) { return t1 - t2;};void Test() { cout

2022-11-14 19:56:25 163

原创 左右值的问题

#includeusing namespace std;void func(int a, int b, int=0) {//右边一定要有个数字,左边默认没有关系 cout

2022-11-12 21:04:56 90

原创 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 337

原创 【无标题】

#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 197

翻译 const 取值

#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;int main() { const int a = 11; int* p = NULL; p = (int*)&a; *p = 20; cout

2022-10-15 19:32:39 229

原创 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 168

原创 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 171

原创 栈表应用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 742

翻译 双链表带头

#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 76

原创 头节点单链表

#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 76

原创 单头链表解释不完整

#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 10:46:22 205

原创 半完成的头单链表

#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 264

原创 头链表C语言

#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-24 21:08:57 75

原创 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 230

原创 顺序表完整得

#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 95

翻译 顺序表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 95

原创 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 76

翻译 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 147

翻译 fseek

#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:50:15 51

翻译 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 190

翻译 格式化 fscanf和fprintf

fscanf

2022-09-21 15:47:59 69

翻译 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 202

原创 fgets

int main(){FILE *fp=fopen("T.txt","r");if(fp==NULL){perror(" ");return -1;}char buf=" ";int i=0;while((buf[i++]=fgets(fp))!=-1);printf("%s\n",buf);return 0;}

2022-09-19 23:11:37 51

原创 FGETS

int main{FILE *fp=fopen("T.txt","w+");if(NULL==fp){ perrer(" ");}char buf="HELLOZXCVB";inu i=0;while(buf[i]!=0){ fputs(buf[i],fp);i++;}fclose(fp);return 0;}

2022-09-19 22:23:52 84

原创 malloc细节

char*P=(char*)malloc(sizeof(char)*25);这里的(char)不带*要和前面的(char*)相比较少一个的

2022-09-18 09:26:17 96

原创 字符串的细节

看到printf("c%",XX);就要用for循环

2022-09-18 09:09:23 40

原创 字符串反转用指针

void GhH(char*f){int g=strlen(f);int *st=f;int*ed=f+g-1;while(st<ed){char tem=*st;*st=*ed;*ed=tem;st++;ed--; }}int main(){char buf[]=“word”;GhH(buf);printf(“%s\n”,buf);return 0;}

2022-09-17 10:34:30 78

原创 字符串反转

void Qstring(char*str){int n=strIen(str);int s=0;int e=n-1;while(s<e){chat tp=str[s];str[s]=str[e];stre[e]=tp;s++;e--; }}intmain(){char buf[]=“abcdefghi”;Qstring(buf);printf(“d%\n”,buf);return 0;}

2022-09-16 22:01:07 72

翻译 字符创倒装

#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 153

原创 char *buf 反转

#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#includechar* t(char* pbuf) { int length = strlen(pbuf); char* p1 = pbuf; char* p2 = pbuf - 1+length;//这个是后面开始算 while (p1 < p2) {

2022-07-17 10:53:48 181

翻译 c语言数组指针

#define _CRT_SECURE_NO_WARNINGS#include#include#includeint main(){ int c[5]; int(*point)[5] = &c; for (int i = 0; i < 5; i++) { (*point)[i] = i; } for(int i = 0; i < 5; i++ ){ printf("c[i]:%d,(*point)[i]:%d\n ", c

2022-07-15 09:53:40 35

原创 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 2100

翻译 C语言间接复制

#define _CRT_SECURE_NO_WARNINGS#include#include#includeint str_copy(char* from, char* to) { char* myfrom = from; char* myto = to; if (from == NULL || to == NULL) { return -1; } while (*myto++ = *myfrom++); printf(

2022-07-11 19:36:18 63

原创 char buf[128]

char buf[128] = { 'a','b','v' };

2022-07-09 21:25:52 308

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除