自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

GOOD LUCK

GOOD LUCK

  • 博客(166)
  • 资源 (1)
  • 收藏
  • 关注

原创 24.C++实现Employee的相关属性和操作

#include <iostream>#include <string>using namespace std;class Employee {private: char name[30]; char street[30]; char city[18]; char zip[6];public: Employee(char* n, char* str, char* ct, char* z); void setName(char* n); void displa.

2020-12-16 14:25:30 1139

原创 23.C++实现自定义矩阵的转置

#include <iostream>#include <string>using namespace std;void move(int* matrix,int n) { int i, j, k; for (i = 0; i < n; i++) { for (j = 0; j < i; j++) { k = *(matrix + i * n + j); *(matrix + i * n + j) = *(matrix + j * n + i.

2020-12-16 13:30:37 650

原创 22.C++实现3*3矩阵的转置

#include <iostream>#include <string>using namespace std;void move(int matrix[3][3]) { int i, j, k; for (i = 0; i < 3; i++) { for (j = 0; j < i; j++) { k = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = k; }.

2020-12-16 13:20:27 3174

原创 21.C++实现计算八个学生的平均成绩

#include <iostream>#include <string>using namespace std;#define N 8float grades[N];//存放成绩的数组int main() { int i; float total, average; //提示输入成绩 for (i = 0; i < N; i++) { cout << "Enter grades #" << (i + 1) << " .

2020-12-16 12:55:16 2167

原创 21.C++统计一句英文里字母的字母数量

#include <stdio.h>#include <iostream>#include <cstdio> using namespace std;int count(char* str) { int i, num = 0; for (i = 0; str[i]; i++) { if ((str[i] >= 'a' && str[i] <= 'z' )|| (str[i] >= 'A' && str[.

2020-12-16 11:51:00 1475

原创 20.C++递归实现反转字符串

#include <iostream>#include <string> using namespace std;string reverse(string& str) { if (str.length() > 1) { string sub = str.substr(1, str.length() - 2); //string s1 = str.substr(str.length() - 1, 1); //string s2 = str.subs.

2020-12-16 11:20:07 933

原创 19.C++枚举以及union联合体的使用

#include <iostream>using namespace std;class DataType { enum{ character, integer, floating_print } vartype; union { char c; int i; float f; };public: DataType(char ch) { vartype=character; c=ch; } DataType(int ii.

2020-12-15 00:13:50 190

原创 18.C++实现Dog类并设置相关属性和进行相关操作

#include <iostream>using namespace std;class Dog { public: Dog(int initialAge=0,int initialWeight=0); ~ Dog(); int getAge() { return age; } void setAge(int age) { this->age=age; } int getWeight() { return weight; } .

2020-12-14 23:52:23 628

原创 17.C++穷举100以内的质数

#include <iostream> #include <cmath>using namespace std;int main(){ int i,j,k,flag; for(int i=2;i<=100;i++){ flag=1; k=sqrt(i); for(int j=2;j<=k;j++){ if(i%j==0){ flag=0; break; } } if(flag){ cout<<.

2020-12-12 23:52:33 712

原创 16.C++实现九九乘法表

#include <iostream> #include <iomanip>using namespace std;int main(){ int i,j; cout<<' '; for(i=1;i<10;i++){ //横着的10个数字 cout<<setw(4)<<i; } cout<<endl; //上个换行 for(int i=1;i<10;i++){ cout<<i;.

2020-12-12 23:36:30 313

原创 15.C++枚举类型的练习-游戏结果输出

代码://2_9.cpp//设某次体育比赛的结果有四种可能,WIN,LOSE,TIE,CANCEL.输赢平退出。#include <iostream>using namespace std;enum GameResult{WIN,LOSE,TIE,CANCEl};int main() { GameResult result; enum GameResult omit= CANCEl; for (int count = WIN; count <= CANCEl; cou

2020-11-18 10:33:36 218

原创 14.C++读入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束

代码://2_9.cpp//读入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束#include <iostream>using namespace std;int main() { int i = 0, j = 0, n; cout << "Please enter some integers(enter 0 to quit):" << endl; cin >> n; while (n != 0) { if (n >

2020-11-18 00:11:27 4679 1

原创 13.C++输出100到200之间不能被3整除的数

代码://2_9.cpp#include <iostream>using namespace std;int main() { for (int i = 100; i <= 200; i++) { if (i % 3 != 0) { cout << i << endl; } } return 0;}运行结果:

2020-11-18 00:03:08 1566

原创 12.C++输出一些特别的图案

代码://2_9.cpp#include <iostream>using namespace std;int main() { const int N = 4; for (int i = 1; i <= N; i++) {//输出前四行图案 for (int j = 1; j <= 30; j++) { cout << " ";//输入30列空格 } for (int j = 1; j <= 8 - 2 * i; j++) { .

2020-11-17 23:58:50 2184

原创 11.C++类和对象程序举例-钟表类

#include <iostream>using namespace std;class Clock { public: void setTime(int newH=0,int newM=0,int newS=0); void showTime(); private: int hour,minute,second;};//成员函数的实现void Clock::setTime(int newH,int newM,int newS) { hour=newH; min.

2020-10-31 21:58:43 450

原创 10.C++8位二进制转十进制

#include <iostream> using namespace std;//计算x的n次方double power(double x,int n);int main(){ int value=0; cout<<"Enter the 8 bit binary number:"<<endl; for(int i=7;i>=0;i--){ char ch; cin>>ch; if(ch=='1'){ value+=s.

2020-10-31 12:10:03 666

原创 9.C++例2-10 输入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束。

//例2-10 输入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束。#include <iostream>using namespace std;int main() { int i=0,j=0,n; cout<<"Enter some integers please (enter 0 to quit):"<<endl; cin>>n; while(n!=0) { if(n>0) i += 1; if(n<0) .

2020-10-29 23:24:05 1601 1

原创 8.C++例2-8:输入一个整数,求出它的所有因子

//例2-8:输入一个整数,求出它的所有因子#include <iostream>using namespace std;int main() { int n; cout<<"Enter a postive integer"<<endl; cin>>n; cout << "Number " << n << " Factors :"; for(int k=1; k<=n; k++) { if.

2020-10-29 23:01:06 3615 2

原创 7.C++例2-4:输入一个0~6的整数,转换成星期输出

#include <iostream>using namespace std;int main() { int day; cin>>day; switch(day) { case 0: cout<<"Sunday"<<endl; break; case 1: cout << "Monday" << endl; break; case 2: cout << "Tuesda.

2020-10-29 22:28:00 2608

原创 6.C++例2-3:输入两个整数,比较两个数的大小

#include <iostream>using namespace std;int main(){ int x,y; cout<<"input x and y"<<endl; cin>>x>>y; if(x!=y) { if(x>y){ cout<<"x>y"<<endl; } else{ cout<<"x<y"<<endl; } ...

2020-10-29 21:45:59 5059

原创 5.C++例2-2输入一个年份,判断是否闰年

If语句的语法形式if (表达式)语句例:if (x > y) cout << x;if (表达式)语句1 else语句2例:if (x > y) cout << x;else cout << y;if (表达式1)语句1else if (表达式2)语句2else if (表达式3)语句3…else语句n#include <iostream>using namespac...

2020-10-29 21:34:17 1529

原创 5-1.C++中while和do...while的区别

先做后爱容易出伤害=。=while#include <iostream>using namespace std;int main(){ int sum,i=0; cout<<"int put i:"<<endl; cin>>i; while(i<=10){ sum+=i; i++; } cout<<"sum="<<sum; return 0;} do...while#include

2020-10-29 16:57:56 553

原创 4.C++条件表达式的简单使用

#include <iostream> using namespace std;int main(){ int a,b,x; cout<<"input the value of a:\n"; cin>>a; cout<<"input the value of b:\n"; cin>>b; x=a-b>0?a-b:b-a; cout<<"The difference of a and b is:\t\t"&.

2020-10-29 12:07:54 396

原创 3.C++变量初始化

#include <iostream> using namespace std;int main(){ const double pi(3.1459); int radis(0); cout<<"The initial radis is:"<<radis<<'\n'; cout<<"The pi is:"<<pi<<'\n'; cin>>radis; cout<<"The radis.

2020-10-28 16:52:24 160

原创 2.C++读入并显示整数

常量变量#include <iostream>using namespace std;int main() { const double pi(3.14159); //定义符号常量pi int radis;//定义变量 cout<<"Please enter the radis!\n"; cin>>radis;//从标准输入设备中读入一个整数存入radis中 cout<<"The radis is:"<<radis<&l.

2020-10-28 16:37:32 489

原创 定义控制台应用程序的入口点 ConsoleApplication

# include <stdio.h># include <iostream> ///iostream这个输入输出流类已经被包含起来 using namespace std;//用的标准的名词空间 int main(){ cout << "hello\n"; return 0;}

2020-10-27 16:36:03 1217

原创 一元二次方程求解 c语言实现

# include <stdio.h>int main(void) { //保存三个系数于计算机中 int a=1; int b=2; int c=2; float x1; float x2; float delta;//delta=b*b-4ac delta=b*b-4*a*c; if(delta>0) { x1=(-b+delta)/2*a; x2=(-b-delta)/2*a; printf("该方程有两个解,x1=%f,x2=%f\n",x1,x.

2020-06-23 23:57:44 835

原创 HelloWorld C语言实现

环境:dev c++ 5.11代码:# include <stdio.h>int main(void) { printf("Hello World"); return 0;}编译结果:运行结果:

2020-06-22 23:40:43 304

原创 归并排序--逐渐简洁

每当看到简洁的代码时,我都一头雾水,,,只好先翻译成我能理解的幼儿园水平。放一个超级好理解的博主的讲解https://www.cnblogs.com/chengxiao/p/6194356.html递归+分治package sort;import com.sun.xml.internal.fastinfoset.util.CharArrayIntMap;public class MergeSortTest { private static void mergeSort(i.

2020-06-21 14:14:09 158

原创 167. 两数之和 II - 输入有序数组 Leetcode Java

//给定一个已按照升序排列 的有序数组,找到两个数使得它们相加之和等于目标数。 //// 函数应该返回这两个下标值 index1 和 index2,其中 index1 必须小于 index2。 //// 说明: //// // 返回的下标值(index1 和 index2)不是从零开始的。 // 你可以假设每个输入只对应唯一的答案,而且你不可以重复使用相同的元素。 // //// 示例: //// 输入: numbers = [2, 7, 11, 15], target = 9.

2020-06-18 09:45:50 179

原创 704. 二分查找 Leetcode Java

//给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标,否//则返回 -1。 //// //示例 1: //// 输入: nums = [-1,0,3,5,9,12], target = 9//输出: 4//解释: 9 出现在 nums 中并且下标为 4// //// 示例 2: //// 输入: nums = [-1,0,3,5,9,12], target = 2//输出: .

2020-06-18 09:34:51 212

原创 19. 删除链表的倒数第 n 个节点 Leetcode Java

//给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 //// 示例: //// 给定一个链表: 1->2->3->4->5, 和 n = 2.////当删除了倒数第二个节点后,链表变为 1->2->3->5.// //// 说明: //// 给定的 n 保证是有效的。 //// 进阶: //// 你能尝试使用一趟扫描实现吗? // Related Topics 链表 双指针//leetcode submit.

2020-06-18 09:24:02 151

原创 876. 链表的中间节点 Leetcode Java

//给定一个带有头结点 head 的非空单链表,返回链表的中间结点。 //// 如果有两个中间结点,则返回第二个中间结点。 //// //// 示例 1: //// 输入:[1,2,3,4,5]//输出:此列表中的结点 3 (序列化形式:[3,4,5])//返回的结点值为 3 。 (测评系统对该结点序列化表述是 [3,4,5])。//注意,我们返回了一个 ListNode 类型的对象 ans,这样://ans.val = 3, ans.next.val = 4, ans.next..

2020-06-18 09:22:09 126

原创 142. 环形链表2 Leetcode Java

//给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。 //// 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。 //// 说明:不允许修改给定的链表。 //// //// 示例 1: //// 输入:head = [3,2,0,-4], pos = 1//输出:tail connects to node index 1//解释:链表中有一个环,其尾部连接到.

2020-06-18 09:20:44 155

原创 141.环形链表 Leetcode Java

//给定一个链表,判断链表中是否有环。 //// 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。 //// //// 示例 1: //// 输入:head = [3,2,0,-4], pos = 1//输出:true//解释:链表中有一个环,其尾部连接到第二个节点。// //// //// 示例 2: //// 输入:head = [1,2], pos = 0//输出:tr.

2020-06-18 09:19:36 129

原创 latex修改模版规定的规则

最近在使用latex模版写简历遇到了小小的坑,在使用个人博客编辑留自己的网站时出了点问题。看似正常的网站链接网站链接图鼠标放上去后浏览器解析的地址一言难尽竟然自动帮我加了http(臣妾完全不想要呀)于是哆哆嗦嗦的跑去了这里搞到了标签名\homepage然后跑来格式文件快捷键crtl+f找到了格式定义的地方将多余的http://去掉就大功告成了!!!...

2020-06-17 15:15:06 1288

原创 latex 输入下划线_

1. 问题Latex中直接使用下划线_,因与系统默认功能相冲突,会报错或者损失信息。2.方法原始符号 修改后 _ \_

2020-06-17 15:01:38 57065

原创 overleaf(latex) 解决无法编译中文的问题 建立运用

latex是老外的网站,默认是无法编译中文的,让需要做中英文双简历并且急着发简历的我真的是如同热锅上的蚂蚁。终于,我在搜罗了无数博主的方法以及阅读了官方文档找到了一个较好的方法。举例:我需要写一份中文简历resume。resume里导了不少其他的模块比如skill,education。像这样:\input{resume/summary.tex}\input{resume/education.tex}\input{cv/skills.tex}\input{resume/expe

2020-06-17 12:00:57 7467

原创 如何在Docker内运行Mysql?

Docker安装Mysql我就不赘述了,下面贴两个我觉得很棒的安装链接。1.CentOS7 下Docker最新入门教程 超级详细 (安装以及简单的使用)https://blog.csdn.net/wzsy_ll/article/details/828666272.Docker 安装 MySQLhttps://www.runoob.com/docker/docker-install-mysql.html下面进入正题,通过docker启动mysql.docker run --name=

2020-06-12 10:20:52 1440

原创 739. 每日温度 Leetcode Java

题目:请根据每日 气温 列表,重新生成一个列表。对应位置的输出为:要想观测到更高的气温,至少需要等待的天数。如果气温在这之后都不会升高,请在该位置用0 来代替。例如,给定一个列表temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是[1, 1, 4, 2, 1, 1, 0, 0]。提示:气温 列表长度的范围是[1, 30000]。每个气温的值的均为华氏度,都是在[30, 100]范围内的整数。解题思路:利用栈和数组...

2020-06-11 20:12:59 192

ssh_pracice1

用户管理系统demo,自己使用的,初学者自用里面有国际化校验等内容!!!!

2018-04-20

空空如也

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

TA关注的人

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