自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 指针和指针应用的区别

 转自:https://www.cnblogs.com/x_wukong/p/5712345.html         http://blog.sina.com.cn/s/blog_673ef8130100imsp.html   指针参数的传递,传递的是对指针的拷贝值,如果在函数中对指针的值进行修改,不会影响到主函数中的值,因为在函数执行完成后,执行这个函数产生局部变量的栈区就会清空.. ...

2018-07-20 10:29:04 1633

原创 无重复字符的最长的子串

滑动窗口的解题思路。strpbrch函数原型:char *strpbrk(char const *s1,char const *s2);//查找任何一组字符(s2)第一次在字符串(s1)位置//找到返回指向该位置的指针//找不到返回指向NULL的指针  int lengthOfLongestSubstring(char* s) { int i=0,j=0,...

2018-07-18 11:14:49 162

原创 输出漏斗

本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏能用掉尽可能多的符号。输入格式:输入在一行给出1个正整...

2018-03-24 23:03:01 1301

原创 常类型

关于常引用的使用方法#include<iostream>using namespace std;int add(const int &i,const int &j);int main(){ int a=20; int b=30; cout<<a<<"+"<<b<<"="<&

2018-03-21 23:20:30 176

原创 C++primer plus递归程序

#include<iostream>using namespace std;const int Len=66;const int Divs=6;void subdivide(char ar[],int low,int high,int leval);int main(){ char ruler[Len]; int i; for(i=1;i<=Len-2;i++)...

2018-03-10 23:30:35 208

原创 整数序列的最大跨度值

#include<iostream>using namespace std;int main(){ int n,max=0; cin>>n; int *c=new int[sizeof(int)*n]; for(int i=0;i<n;i++){ cin>>C[i]; } for(int i=0;i<n;i++){...

2018-03-10 21:29:55 2819

原创 一个小的关于学生成绩的类

#include <iostream>#include <string>#include <cstdio>#include <cstring>#include <sstream>#include <cstdlib>using namespace std;class Student { private: ch...

2018-03-09 22:43:39 292

原创 Fighting!!!!

今年大二,准备考研,定个小目标考上上海交大或者北京航空航天大学。                                  Fighting!!

2018-03-08 23:29:38 157

原创 奇数求和

#include<iostream>using namespace std;int arry(int m,int n){ int sum=0; for(int i=m;i<=n;i++){ if(i%2!=0){ sum=sum+i; } } cout<<sum<<endl; return 0;} int main(){ ...

2018-03-08 23:28:12 2038

原创 汉诺塔与苹果与虫子问题

#include<iostream>using namespace std;int main(){ int n,x,y; do{ cin>>n>>x>>y;}while(y>=x*n); int sum; if(y%x==0){ sum=n-y/x; } else sum=n-y/x-1; cout<<s...

2018-02-26 17:13:48 389

原创 简单的递归C++程序

// ConsoleApplication1.cpp: 定义控制台应用程序的入口点。//#include "stdafx.h"#include<iostream>using namespace std;void Countdown(int n) { cout << "Counting down....." << n << endl; ...

2018-02-26 15:58:40 283

原创 输出前k序列数组

上学一年,学习C语言半年时间,C++纯靠自学,当我刚接触完一些数组之后,自负到已经将C++参悟透。知道半年后重新将C++拾起,才知道以前自己的眼光多么狭窄!!感慨一番。#include<iostream>#include<vector>#include<stdio.h>using namespace std;int main(){ int a[50];...

2018-02-19 11:50:59 220

翻译 拦截导弹

这个C++程序采用了最长降序子列算法,见答案讲就是创建两个数组,然后一个数组是用来存数(这个是进行比较的数),另外一个数组是用来进行存取每个数对应的最长降序子列的第一个数的多少。第二个数组中序列的关系就是void Lis(int k){ memset(longest,0,sizeof(longest)); for(int i=1;i<=k;i++){ longest[i]=1; ...

2018-02-17 21:20:12 290

原创 密码翻译

/*这篇程序少部分参考网上的内容,对于我来讲对if条件掌控需要更加深入。*//*if('a'<=str[j]<='y'||'A'<=str[i]<='Y')*/#include<iostream>#include<cstring>using namespace std; int main(){ char str[100]; gets(st...

2018-02-13 18:57:09 885

原创 角谷猜想

小白写了一个关于验证角谷猜想的c++程序。不过有个小问题就是159487这个数字输进去后计算会出现乱码这种现象。其他的应该都是没有问题的。所以仅供参考。#include<iostream>using namespace std;int ode(int n){ if(n%2==0){ return true; } else if(n%2!=0){ return fals...

2018-02-13 13:04:23 1698 2

原创 画矩形

#include<iostream>#include<iomanip>using namespace std;int main(){ int n,m,k; string c; cin>>n>>m>>c>>k; for(int j=0;j<m;j++){ for(int i=0;i<n;i++){

2018-02-10 16:36:30 305

原创 关于如何求取分数序列和

#include<iostream>#include<iomanip>using namespace std;int main(){ float p[20],q[20]; p[0]=1; q[0]=2; int n=0; float sum; cin>>n; for(int i=0;i<n;i++) { q[i+1]=p[i]+...

2018-02-10 13:23:54 292

转载 给定范围求素数对

#include<iostream>using namespace std;int prime(int n){ if(n%2==0&&n!=2){ return 0; } for(int i=3;i<n;i++) { if(n%i==0) { return 0; } } return 1;}int main(){ i...

2018-02-09 21:20:13 309

转载 老人看病C++写法

#include<iostream>#include<string>using namespace std;struct patient{ int age; char id[10]; int sequence;};int Compare(patient a,patient b){ if(a.age>=60&&b.age>=60...

2018-02-08 19:14:15 610

空空如也

空空如也

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

TA关注的人

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