- 博客(54)
- 资源 (1)
- 收藏
- 关注
原创 sublime text3之emmet插件安装
1、打开sublime,preferences->Browse Packages。2、下载我上传的emmet插件压缩包,将解压后的文件夹,复制到1中打开的文件夹中。(ps:我知道如何制作文件下载所需url时会更新免费的下载链接,现在这个需要积分(ps:csdn自己定的积分,我本来想免费的。))3、重启sublime4、安装成功测试:输出英文格式的!再按下tab键,即可生成<!d...
2019-03-08 14:55:59
298
原创 vector补录之重新定义vector大小
#include<iostream>#include<string>#include<vector>using namespace std;int main(){ vector<int> a; cout << a.size() << endl;//0 a.push_back(0); a.push_back(1)...
2019-03-05 16:23:04
1485
原创 多变量一行赋值
#include<iostream>#include<string>using namespace std;int main(){ int a,b; a=b=1; string sa,sb; sa=sb="sdf"; cout << a << " " << b << endl; cou
2019-03-05 14:49:31
2416
原创 vector之assign
#include <iostream>#include <vector>using namespace std;int main() { int n; vector<int> a,b(1),c(1); a.push_back(1); a.push_back(2); a.push_back(3); b[0]=66; c[0]=84; b....
2019-03-03 15:50:30
822
原创 stringstream与atoi实现字符串与int,double型转换之比较
#include <iostream>#include <string>#include <sstream>using namespace std;int main() { string s="54.653"; double d=atoi(s.c_str()); cout << d << endl;//54 strings...
2019-03-01 13:02:18
181
原创 OJ:易错点
scanf 时 要带&amp;amp;例:scanf(&quot;%d&quot;,&amp;amp;a);
2019-03-01 10:45:01
215
原创 OJ:fill的用法
#includeusing namespace std;int a[100],b[100][100];const int inf=100000;int main(){fill(a,a+100,inf);fill(b[0],b[0]+100*100,0);return 0;}
2019-03-01 10:44:53
178
原创 csdn:Markdown编辑器不显示#include头文件里面内容
错误显示:#include正确显示:#include&amp;lt; algorithm&amp;gt;做法 在 &amp;lt; 后面加一个空格
2019-03-01 10:44:46
932
2
原创 OJ:从文本中输入 输出到文本中(省去键盘重复输入)
FILE *fp; fp=fopen("in.txt","r");//以只读模式打开 fscanf(fp,"%d%f",&a,&b); fp=fopen("out.txt","w");//以只写模式打开 fprintf(fp,"%d %.1f",a,b); fclose(fp);...
2019-03-01 10:44:30
229
原创 OJ:fill的用法
#include <algorithm>using namespace std;int a[100],b[100][100];const int inf=100000;int main(){ fill(a,a+100,inf); fill(b[0],b[0]+100*100,0); return 0;}
2019-03-01 10:44:21
188
原创 OJ:STL之queue
#include&amp;lt;iostream&amp;gt;#include&amp;lt;queue&amp;gt;using namespace std;int main(){ queue&amp;lt;int&amp;gt; q; cout &amp;lt;&amp;lt; q.empty() &amp;lt;&amp;lt;
2019-03-01 10:44:12
281
原创 OJ:STL之vector
#include&amp;lt;iostream&amp;gt;#include&amp;lt;vector&amp;gt;using namespace std;vector&amp;lt;int&amp;gt; v(100);//()声明一维数组 且赋v[i]初值0vector&amp;lt;int&amp;gt; v2[100];//[]声明二维数组 且赋v2[i][
2019-03-01 10:43:56
185
原创 OJ:字符串转化为int型
#include&amp;lt;iostream&amp;gt;using namespace std;int main(){ char s[100]=&quot;123&quot;; int a=atoi(s);//参数不可为字符 cout &amp;lt;&amp;lt; a; return 0;}
2019-03-01 10:43:46
168
原创 OJ:stringstream实现int型与string型的相互转化
#include&amp;lt;iostream&amp;gt;#include&amp;lt;sstream&amp;gt;using namespace std;int main(){ stringstream ss; string str=&quot;22222&quot;; int a=100; ss &amp;lt;&amp;lt; a; ss &
2019-03-01 10:43:40
567
原创 OJ:ifstream与ofstream实现对文件的读与写
#include&amp;lt;iostream&amp;gt;#include&amp;lt;fstream&amp;gt;#include&amp;lt;vector&amp;gt;using namespace std;vector&amp;lt;int&amp;gt; v[100];int main(){ ifstream fin; fin.open(&
2019-03-01 10:43:30
234
原创 OJ:int型的最大值 及 溢出现象
#include&amp;lt;iostream&amp;gt;#include&amp;lt;iomanip&amp;gt;#include&amp;lt;fstream&amp;gt;#include&amp;lt;sstream&amp;gt;#include&amp;lt;algorithm&amp;gt;#include&
2019-03-01 10:43:20
905
原创 OJ:switch case语句使用
#include&amp;lt;iostream&amp;gt;#include&amp;lt;vector&amp;gt;using namespace std;char tran(int i);int main(){ cout &amp;lt;&amp;lt; tran(3); return 0;}char tran(int i){ char t; switch(i){ case 1:
2019-03-01 10:43:11
261
原创 vector与数组的区别补录
int n;cin &amp;amp;gt;&amp;amp;gt; n;vector a(n);//可以定义非常量一维数组//而int b[n]则会报错,提示应输入常量表达式
2019-03-01 10:43:03
208
原创 OJ:int型转化为字符数组
#include&amp;lt;iostream&amp;gt;using namespace std;int main(){ char ssum[10]; itoa(123,ssum,10); //第三个参数是进制 printf(&quot;%s&quot;,ssum); return 0;}
2019-03-01 10:42:48
169
原创 OJ:cout 控制小数点后位数
#include&amp;lt;iostream&amp;gt;#include&amp;lt;iomanip&amp;gt;using namespace std;int main(){ float f=123.456789; cout &amp;lt;&amp;lt; fixed &amp;lt;&amp;lt; setprecision(1) &am
2019-03-01 10:42:30
191
原创 OJ:algorithm头文件中sort函数的应用
#include&amp;lt;iostream&amp;gt;#include&amp;lt;algorithm&amp;gt;using namespace std;struct student{ int id; int grade[4];};int k;student s[2001];bool cmp(int a,int b){ return a&amp;gt;b;}bool cmp1(studen
2019-03-01 10:42:24
235
原创 OJ:使用cin时运行超时
c++为了兼容c,保留了c中的stdin与stdout,通过关闭其与cin与cout的同步,实现运行时间的大量减少。ios::sync_with_stdio(false);
2019-03-01 10:42:17
834
原创 STL之map定义,使用与遍历
#include&amp;amp;lt;iostream&amp;amp;gt;#include&amp;amp;lt;map&amp;amp;gt;using namespace std;int main(){ map&amp;amp;lt;string,int&amp;amp;gt; m; m[&amp;quot;a&amp;quot;]=3; m[&
2019-03-01 10:42:08
485
原创 参数传值与传地址
#include&amp;lt;iostream&amp;gt;#include&amp;lt;algorithm&amp;gt;#include&amp;lt;fstream&amp;gt;#include&amp;lt;vector&amp;gt;#include&amp;lt;map&amp;gt;#include&a
2019-03-01 10:41:59
145
原创 sort用法补录
//sort在作用于数组与vector时方式不同int a[100];sort(a,a+50,cmp);vector&amp;lt;int&amp;gt; b(100);sort(b.begin(),b.end(),cmp)
2019-03-01 10:41:50
130
原创 printf用法补录
printf属于c语言,而string类型属于c++,故string不可由printf直接输出,虽然可以用.c_str()来转换,但这很不c++,故需在输出string类型时用cout。
2019-03-01 10:27:53
113
原创 0-15与0-A-F之间的转换
#include&amp;amp;amp;lt;iostream&amp;amp;amp;gt;using namespace std;int main(){ int ia='5'-'0'; int ib='D'-'A'+10; char ca=3+'0'; char cb=12-10+'A'; cout &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;amp;quot;char to
2019-03-01 10:27:34
315
原创 string之取子串
#include&amp;lt;iostream&amp;gt;#include&amp;lt;string&amp;gt;using namespace std;int main(){ string s=&quot;helloworld&quot;; string a=s.substr(0,4); //substr(startPosition,lenth) cout &amp;lt;
2019-03-01 10:27:23
12997
原创 switch case 写法补录
switch(t[j]){ case '1':t[j]='@';mod=true;break;//可以一行写多个语句 case '0':t[j]='%';mod=true;break; case 'l':t[j]='L';mod=true;break; case 'O':t[j]='o';mod=true;break;}
2019-03-01 10:27:14
405
原创 手把手教你贴赞赏码
博主如何直接得到打赏呢,可以贴个收款码对吧,然后发现有赞赏码,就图个新鲜,搞个赞赏码啦。(PS:想学的话,可以微信-&amp;amp;amp;amp;gt;我-&amp;amp;amp;amp;gt;支付-&amp;amp;amp;amp;gt;收付款-&amp;amp;amp;amp;gt;赞赏码)...
2019-03-01 10:27:06
1240
原创 string数组定义
string s[]={“S1”,“S2”,“S3”};string s[3]={“S1”,“S2”,“S3”};string s[40]={“S1”,“S2”,“S3”};//下标3及以后的为&quot;&quot;
2019-03-01 10:26:59
2819
sublime3之emmet插件压缩bao
2019-03-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人