- 博客(21)
- 收藏
- 关注
原创 Java自动售货机小作业版本
package gui;import java.awt.*;import javax.imageio.ImageIO;import javax.swing.*;import java.awt.event.*;import java.applet.*;public class gui extends JFrame implements ActionListener{ int po...
2018-11-23 18:37:08
1897
原创 Java上机实验
下午实验课要求:1.带jdk和编程软件。2.生成100个和一万个元素的随机值数组。3.试用冒泡等经典算法、快速排序和数据自带排序方法,记录实验数据。4.比较算法在不同情况下的效率,进行讨论,撰写实验报告。import javax.swing.*;public class example{ static int ran[] = new int[100]; static...
2018-10-10 15:43:47
940
原创 Java的3种排序实现
冒泡排序:public class example{ public static void main(String args[]) { int a[]= {9,3,1,4,2,7,8,6,5}; int len=a.length; for(int i=0;i<len-1;i++) { for(int j=i+1;j<len;j++) { if...
2018-10-07 16:32:16
609
原创 《算法笔记》二叉树学习笔记
做pat做到1020这题目,刚好看到《算法笔记》上面有解决这道题目的方法于是就做下笔记题目是给出后序遍历跟中序遍历要你求层序遍历 #include<cstdio>#include<string>#include<queue>#include<algorithm>using namespace std;const int max...
2018-09-29 22:20:40
340
2
原创 《算法笔记》Dijkstra算法笔记
今日在华农终于接近完成阅读算法笔记,有点点成就感,做下dijkstra跟DFS算法结合的笔记简单状态:纯dijkstra:#include<iostream>#include<algorithm>#include<vector>#define inf 1000000000using namespace std;const int maxn=1...
2018-09-22 23:32:17
532
原创 VHDL大作业
用VHDL语言设计多功能电子钟,用QuartusII工具编译和综合,并在实验板上调试并实现所要求功能和技术指标,撰写实验报告,最后提交验收并答辩。题目:多功能电子钟。主要功能要求:1、 电子时钟。要求用24时制显示。分屏显示“时、分”和“分、秒”,即4个数码管不能同时显示“时、分、秒”,但可以只显示“时、分”,或只显示“分、秒”,通过按键来切换这两种显示方式。用数码管的小数点“.”代替时、...
2018-07-11 14:32:42
2913
7
转载 类的应用
#include <iostream>#include<stdlib.h>#include<string.h>using namespace std;class StringClass{ char* s; int n; friend istream& operator>>(istream& istr, StringC...
2018-03-05 18:58:55
163
原创 队列的链队子函数
#include#includetypedef int ElemType;struct LNode{ ElemType data; LNode* next;};struct LinkQueue{ LNode* front; LNode* rear;};void InitQueue(LinkQueue& HQ){ HQ.front = HQ.rear = NUL
2017-12-07 20:18:56
309
原创 单链表上机实验
#include typedef int ElemType;struct LNode{ ElemType data; LNode* next;};void InitList(LNode* &HL){ HL = NULL;}void ClearList(LNode*& HL){ LNode *cp, np; for (cp = HL; cp != NULL;cp=
2017-12-03 20:37:56
439
原创 Project Euler__problem 10
Problem 10Summation of primesThe sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.素数的和所有小于10的素数的和是2 + 3 + 5 + 7 = 17。求所有小于两百万的素数的和。
2017-12-02 11:28:51
238
原创 Project Euler__problem 9
Problem 9Special Pythagorean tripletA Pythagorean triplet is a set of three natural numbers, a a2 + b2 = c2For example, 32 + 42 = 9 + 16 = 25 = 52.There exists exactly one Pythagorean trip
2017-12-02 10:36:20
177
原创 第三关挑战题
#include#includetypedef char ElemType;struct SNode{ ElemType data; SNode* next;};void InitStack(SNode*& HS){ HS = NULL;}void Push(SNode*& HS, const ElemType& item){ SNode* newptr = n
2017-11-30 23:53:32
264
原创 栈的子函数
#include#includetypedef int ElemType;struct SNode{ ElemType data; SNode* next;};void InitStack(SNode*& HS){ HS = NULL;}void Push(SNode*& HS, const ElemType& item){ SNode* newptr = ne
2017-11-30 23:23:23
222
原创 Project Euler__problem 3
做到第3题遇到可以算得上是真正的数学难题目前我的数学水平有限看到题目就懵逼了一下,前面2道题目我都习惯先用笔算算出结果,然后再用计算机去解出答案对照Largest prime factorThe prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the
2017-10-02 20:12:50
193
原创 Project Euler__problem 2
Even Fibonacci numbersEach new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 8
2017-09-28 19:00:35
210
原创 Project Euler__problem 1
在一个师兄那里看到在刷Project Euler感到兽血沸腾,有种刷题的冲动首先就比较简单的第一题做起Multiples of 3 and 5If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these mult
2017-09-28 18:32:33
305
原创 挑战题一(3)
设计课程(course)结构(如p50例2-2), 1)重载==运算符,查找出课程名为“英语”的记录; 2)重载==运算符,查找出开课学时为72的所有记录; 3)重载>运算符,查找出开课学时>80的所有课程记录。 设计main函数,先创建p51的表2-1,然后实现上述功能。根课本的例子基本一致但我做出的界面不好看不知道怎么用C++修改字符输出宽度
2017-09-26 16:52:25
402
原创 挑战题一(2)
也是差不多设计一个候选人得票的统计程序。设有3个候选人,每次模拟一个选民投票,输入一个候选人的名字,选民人数任意,全部选民输入完后要求输出每个候选人的得票结果。(用struct类型。此程序的功能可以自行拓展)#include#includestruct houxuanren{ char name[20];};void main(){ char toupia
2017-09-25 18:49:48
324
原创 挑战题一(1)
老师布置的挑战题感觉不是很难,很容易做出来了但我细节还是不够好下面是题目4、请编写函数int fun(int *a, int n),函数的功能是把数组a中最大数和最小数交换。在主函数中输入10个整数、调用fun函数、输出结果。#includevoid fun(int *a,int n);int main() { int a[10], i; std::
2017-09-25 17:51:33
287
原创 51单片机作业
#include#include#define uchar unsigned char #define uint unsigned int #define L P0sbit L1=P0^0;sbit L2=P0^1; sbit L3=P0^2;sbit L4=P0^3;sbit L5=P0^4;sbit L6=P0^5;sbit L7=P0^6;sbit L8=P0^7;
2017-01-04 21:59:57
983
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人