c++
qq_31204121
这个作者很懒,什么都没留下…
展开
-
c++学习 打卡第一天《函数的递归调用》
1:求n!#include "stdafx.h"#include <iostream>using namespace std;unsigned spc(unsigned m){ unsigned f; if(m==0) f=1; else f=spc(n-1)*n; return f;}int mai...原创 2019-03-20 20:40:31 · 118 阅读 · 0 评论 -
c++学习 打卡第五天
#include<iostream>using namespace std;enum cpu_rank{p1,p2,p3,p4,p5,p6,p7};class cpu{ private: cpu_rank rank; unsigned int frequency; unsigned int voltag...原创 2019-03-25 11:44:07 · 113 阅读 · 0 评论 -
c++学习 打卡第二天《汉诺塔》
首先介绍一下汉诺塔游戏规则:有三根柱子A,B,C,A上有N个盘子,大的在下,小的在上,要求把这N个盘子从A移到C上,在移动过程中,可以借助B,每次只允许移动一个盘,且在移动过程中,在三根柱子上都保持大盘再下,小盘在上。将N个盘子从A移到C可以分为三个步骤,现解题思路如下:1:将A上N-1个盘子移到B上,(借助C柱),2:将A盘剩下的一个移到C上,3:将N-1个盘子从B移到C上(借助A柱)。#...原创 2019-03-21 21:06:40 · 199 阅读 · 0 评论 -
c++学习 打卡第三天《引用》 补发
引用是标识符的别名,定义一个引用时,必须同时对它进行初始化,使它指向一个已存在的对象。符号为&,两个程序区别一下:1:#include <iostream>using namespace std;void swap(int a,int b){ int t=a; a=b; b=t;}int main(){ int x=5,y=...原创 2019-03-23 09:48:20 · 104 阅读 · 0 评论 -
c++学习 打卡第六天
#include<stdio.h>int main(){ int a[3][4]={1,3,5,7,9,11,13,15,17,19,21,23}; printf("%d,%d\n",a,*a);//0行首地址和0行0列元素地址 printf("%d,%d\n",a[0],*(a+0));//0行0列元素地址 printf("%d,%d\n",&a...原创 2019-04-04 09:14:34 · 184 阅读 · 0 评论 -
c++学习 打卡第四天《函数》
#include<iostream>#include<cmath>using namespace std;class point{private: int x, y;public: point(int xx = 0, int yy = 0) { x = xx; y = yy; } point(point &p); int getx(...原创 2019-03-24 16:52:47 · 219 阅读 · 0 评论 -
c++学习 打卡第五天
#include "stdafx.h"#include <iostream>using namespace std;class Mouse{ /* Your code here! */public: static int num; Mouse(){ num++; } Mouse(const Mouse &m){ num++; }; ~Mouse(){ nu...原创 2019-03-27 18:57:52 · 112 阅读 · 0 评论 -
操作技巧
1:对于vs2017一闪而过的现象,可以使用cin.get();以及system("pause");2:$finish和$stop都是停止仿真,$finish会弹出对话框,询问是否结束仿真,$stop则会停止在这条语句上。3:wait(条件表达式) 语句;例如:forever wait(start) #10 go = ~go;功能是等待start为true,然后延迟10个时间单位后,输出g...原创 2019-08-02 16:13:24 · 113 阅读 · 0 评论