随笔分类 -  c++拓展题

202006XX-静态存储持续性\无连接性
摘要://static.cpp-using a static local variable#include <iostream>using namespace std;//constants 常量const int ArSize=10;//function prototype 函数原型void strco 阅读全文

posted @ 2020-06-02 19:52 财盛 阅读(123) 评论(0) 推荐(0)

20191207-do while练习,输入三次密码
摘要:#include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { string pwd="a123"; string n=""; int j=1; do { cout<<"请第"<< 阅读全文

posted @ 2020-05-21 08:45 财盛 阅读(680) 评论(0) 推荐(0)

20191117-STD::讲解及求平均数例题
摘要:#include "stdafx.h" #include "cstdio" #include "iostream" #include "algorithm" using namespace std; int main() { char grade='A'; switch(grade) { case 阅读全文

posted @ 2020-05-21 08:44 财盛 阅读(348) 评论(0) 推荐(0)

20191123-SWITCH后面跟的参数不能为string类型
摘要:#include "stdafx.h" #include "cstdio" #include "iostream" #include "algorithm" using namespace std; int main() { string grade="A"; if (grade=="A") cou 阅读全文

posted @ 2020-05-21 08:43 财盛 阅读(551) 评论(0) 推荐(0)

20200105-输入若干整数,求其中的奇数之和及偶数之和
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int a,b,c,d; int main() {for (c=0;c>=0;c++) //此处可用替换 阅读全文

posted @ 2020-05-21 08:35 财盛 阅读(1828) 评论(0) 推荐(0)

20200112-曼哈顿距离
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int a,b,c,d,e,f; int main() {cin>>a; cin>>b; cin>>c; 阅读全文

posted @ 2020-05-21 08:34 财盛 阅读(158) 评论(0) 推荐(0)

202002XX-变量的作用域
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" void oil(int x); using namespace std; int main() { int texas=31; int year 阅读全文

posted @ 2020-05-21 08:32 财盛 阅读(142) 评论(0) 推荐(0)

202002XX-函数重载
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; struct job { char name[40]; double salary; int floor 阅读全文

posted @ 2020-05-21 08:26 财盛 阅读(138) 评论(0) 推荐(0)

202002XX-函数模板2
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; template <typename T> void swap1(T &a,T &b);//引用变量 t 阅读全文

posted @ 2020-05-21 08:25 财盛 阅读(138) 评论(0) 推荐(0)

20200118-函数模板
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; template <class T> //或者template <typename T>注意没有分号 v 阅读全文

posted @ 2020-05-21 08:16 财盛 阅读(108) 评论(0) 推荐(0)

20200118-指针的特殊用法
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; unsigned long left(unsigned long num,unsigned ct); c 阅读全文

posted @ 2020-05-21 08:15 财盛 阅读(182) 评论(0) 推荐(0)

20200104-指针
摘要:#include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int main() { //第一组代码 int updates=6; int *pt=&updates 阅读全文

posted @ 2020-05-21 08:13 财盛 阅读(130) 评论(0) 推荐(0)

20191222-指针题2(指针+地址+引用变量)
摘要:代码1: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int rats=101; int *pt=&rats; //101 int & rodents=*pt; 阅读全文

posted @ 2020-05-21 08:12 财盛 阅读(141) 评论(0) 推荐(0)

20191221-指针题
摘要:代码1: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int a=5; cout<<&a<<endl; a=6; cout<<&a<<endl; int *p= 阅读全文

posted @ 2020-05-21 08:01 财盛 阅读(104) 评论(0) 推荐(0)

20191116-SWITCH
摘要:#include "stdafx.h" #include "cstdio" #include "iostream" using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int m=a; if(m>b) m=b; if(m>c) 阅读全文

posted @ 2020-05-21 08:00 财盛 阅读(104) 评论(0) 推荐(0)

20191110输入一个四位数,求最小值的3种解法
摘要:#include "stdafx.h" #include "cstdio" #include "iostream" using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int m=a; if(m>b) m=b; if(m>c) 阅读全文

posted @ 2020-05-21 07:59 财盛 阅读(410) 评论(0) 推荐(0)