
C++语言
Yes ,I can !
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
大整数除法、乘法、加法(C++实现)
//#include<bits/stdc++.h> #include<iostream> #include<cctype> #include<algorithm> using namespace std; string s; // 大整数除以一位整数 string divide(string s, int x){ int temp = 0; for(int i=0; i<s.size(); i++){ temp = tem原创 2021-07-20 21:58:28 · 601 阅读 · 0 评论 -
C++实现字符串的split分割函数
C++没有类似Python的split函数,如何实现分割字符串呢? //#include<bits/stdc++.h> #include<iostream> #include<vector> using namespace std; string s; //s: 原始串 c:分隔符 sp:分割结果 void split(string s, vector<string> &sp, string c){ int pos1, pos2; p原创 2021-06-28 21:44:32 · 212 阅读 · 1 评论 -
c++关于set,map,list,tuple,无穷值,整型与字符串的转换等
定义无穷大/小: #include<limits.h> int a=INT_MIN; int b=INT_MAX; long long c=LONG_MAX; long long d=LONG_MIN; 字符串与整形的转换: string s="12345.6"; int a=stoi(s); //12345 string to int double b=stod(s); //12345.6 string to double long long c=stoll(s); //1234.原创 2021-04-01 19:34:31 · 572 阅读 · 0 评论 -
malloc为二维数组动态分配内存
首先区别一下double **a 与 double *a[]: #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; int main(){ int row=20, colum=10; double **a; cout<<sizeof(a)<<endl; // 输出为4 double *b[row原创 2020-12-08 20:43:39 · 1639 阅读 · 0 评论 -
c++指针的坑
总结: 一、使用指针的步骤: 声明 分配内存 初始化 二、对指针的的初始化只有两种方式: 把一个分配了内存的地址赋给他 用malloc给他分配一个内存,然后初始化 如何理解1.呢? char buffer[100]; strcpy(buffer, "aaa"); //buffer="aaa"是错误的;如果是char *buffer; buffer="aaa"则正确;虽然char *buffer;并没有给buffer分配内存,但是字符串常量“aaa”就相当于一个分配了内存的地址。 char原创 2020-11-24 21:43:41 · 338 阅读 · 0 评论 -
c++结构体的“普通变量”和“指针变量”的区别
c++结构体的“普通变量”和“指针变量”的区别: 普通变量: #include <stdlib.h> #include <iostream> using namespace std; typedef struct { int m; }Student, *Child; void Creat(Student &student){ //区别一:普通的不需要n...原创 2020-03-25 00:16:48 · 1238 阅读 · 0 评论