学习心得
其实我还好ii
这个作者很懒,什么都没留下…
展开
-
struct和typedef struct
最近在学数据结构,发现这个出现的频率有点高,奈何我悟性不高,好记性不如烂笔头,干脆记下来好了。 1.注意在c++和c里的区别 C语言: 1.1 struct Student { int a; }; 此时申请变量只能是struct Student s1 1.2 typedef struct Student { int a; }Stu; 这里的typedef作用就是申请一个别名,我们可以声明变量时用Stu s1也可以struct Student s1 1.3原创 2021-09-20 11:53:23 · 97 阅读 · 0 评论 -
string的find()函数,即PAT1029总结
1.C++ string中的find()函数 一直都对c++的find函数不太明白,做了此题以后,理解的更透彻了。 最初,我只理解这种形式: char stl[] ="http://c.biancheng.net/stl/"; //调用 find() 查找第一个字符 'c' char * p = find(stl, stl + strlen(stl), 'c'); //判断是否查找成功 if (p != stl + strlen(stl)) { cout &原创 2021-04-17 16:35:50 · 137 阅读 · 0 评论 -
最近写while循环的小心得
起因是因为这个题目: AC代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { //freopen("input.txt","r",stdin); int a, b; int flag = 0; //flag用于控制一次输出的空格 while (cin>>a>>b ) {原创 2021-04-11 13:18:51 · 293 阅读 · 0 评论 -
数据的类型转换总结
介绍: atoi: 作用:把string类型的数字转化为int类型; stoi: 作用:把char类型的数字转化为int型; strtoi(可认为是atoi的加强版): long int strtol(const char *nptr,char **endptr,int base); 作用:把char型的数字转化为long型; to_string: 作用: 包含在#include<iostream>作用是把数值类型如int、double、long等转化为string 注意: 1.把string原创 2021-04-18 19:06:30 · 214 阅读 · 1 评论