Git使用总结

摘要: 检出git仓库代码本地进入的某一文件夹,git clone http://..../test.git(仓库地址)就可以把仓库代码捡到本地指定文件夹。 查看分支git branch -r(查看远程分支) git branch -a(查看左右分支) git branch(查看本地分支) 检出远程指定分支 阅读全文
posted @ 2017-07-06 10:20 一颗向上的草莓 阅读(101) 评论(0) 推荐(0) 编辑

交换输出

摘要: 输入n(n 2 int main() 3 { 4 int n,i,j,t,a[100],min; 5 while(scanf("%d",&n)!=0) 6 { 7 if(n==0) 8 break; 9 j=0;//必须要对j赋值为010 fo... 阅读全文
posted @ 2014-04-25 11:13 一颗向上的草莓 阅读(169) 评论(0) 推荐(0) 编辑

素数距离问题

摘要: 现在给出你一些数,要求你写出一个程序,输出这些整数相邻最近的素数,并输出其相距长度。如果左右有等距离长度素数,则输出左侧的值及相应距离。如果输入的整数本身就是素数,则输出该素数本身,距离输出0题目详情 http://acm.nyist.net/JudgeOnline/problem.php?pid=... 阅读全文
posted @ 2014-04-23 15:20 一颗向上的草莓 阅读(133) 评论(0) 推荐(0) 编辑

求平均成绩

摘要: 1 /*用数组元素作为实参时向形参传递的是数组元素的值, 2 而用数组名做实参时向形参传递的是数组元素的首地址*/ 3 #include 4 int main() 5 { 6 float average(float array[10]); 7 int i; 8 float aver,score[10]; 9 for(i=0;i<10;i++)10 scanf("%d",&score[i]);//缺少&不会报错,但执行时会闪退11 printf("\n");12 aver=average(score);//数组名做实参13 ... 阅读全文
posted @ 2014-04-06 11:29 一颗向上的草莓 阅读(145) 评论(0) 推荐(0) 编辑

打擂台

摘要: 1 #include 2 int main() 3 { 4 int max(int,int); 5 int m,a[10],i,j,n=0; 6 for(i=0;im)//数组元素作为函数实参11 {12 m=max(m,a[j]);13 n=j;14 }15 }16 printf("max=%d,num=%d",m,n+1);17 return 0;18 }19 20 int max(int x,int y)21 {22 return(x>y?x:y);2... 阅读全文
posted @ 2014-04-06 11:13 一颗向上的草莓 阅读(223) 评论(0) 推荐(0) 编辑

汉诺塔

摘要: 1 #include 2 int main() 3 { 4 void hanoi(int n,char one,char two,char three); 5 int m; 6 printf("The step to move %d disks:\n",m); 7 scanf("%d",&m); 8 hanoi(m,'A','B','C'); 9 return 0;10 }11 12 void hanoi(int n,char one,char two,char three)//定义汉诺函数,作用是 阅读全文
posted @ 2014-04-05 23:01 一颗向上的草莓 阅读(108) 评论(0) 推荐(0) 编辑

画格子

摘要: 1 /*写一个“格子涂色”的游戏,要求:屏幕上有 16x8 的格子,屏幕底部有类似画 2 笔中的选色区(随便放上一些常用的颜色),鼠标点击选择区的颜色后,就作为 3 当前颜色,然后再点屏幕上的格子,就可以用刚才的颜色填涂相应格子*/ 4 // 鼠标画三角形.cpp : Defines the entry point for the console application. 5 6 7 #include 8 #include 9 #include "conio.h"10 11 void main()12 {13 int i;14 15 initgraph(800, 50... 阅读全文
posted @ 2014-04-04 22:09 一颗向上的草莓 阅读(280) 评论(0) 推荐(0) 编辑

鼠标控制绘图

摘要: 1 /*先写个代码对比一下: 2 获取按键: 获取鼠标: 3 char c; MOUSEMSG m; 4 if (kbhit()) if (MouseHit()) 5 c = getch(); m = GetMouseMsg();*/ 6 /*通过该结构体,我们可以获取鼠标的如下信息: 7 struct MOUSEMSG 8 { 9 UINT uMsg; // 当前鼠标消息10 bool mkCtrl; // Ctrl 键是否按下11 bool mkShift; // Shift 键是否按下12 bool mkLButton; // 鼠标左键是否按下13 bool mkMButton; //. 阅读全文
posted @ 2014-04-04 21:40 一颗向上的草莓 阅读(192) 评论(0) 推荐(0) 编辑

改进时钟(小熊时钟)

摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define PI 3.1415926 8 void Draw(int hour,int minute,int second) 9 { 10 double a_hour,a_min,a_sec; 11 int x_hour,y_hour,x_min,y_min,x_sec,y_sec; 12 int x_hour1,y_hour1,x_min1,y_min1,x_sec1,y_sec1; 13 a_sec = second*2*PI... 阅读全文
posted @ 2014-04-03 22:30 一颗向上的草莓 阅读(380) 评论(0) 推荐(0) 编辑

钟表

摘要: 1 #include 2 #include 3 #include 4 #define PI 3.14159265359 5 void Draw(int hour, int minute, int second) 6 { 7 double a_hour, a_min, a_sec; 8 // 时、分、秒针的弧度值 9 int x_hour, y_hour, x_min, y_min, x_sec, y_sec;10 // 时、分、秒针的末端位置11 // 计算时、分、秒针的弧度值12 a_sec = second * 2 * PI / 60;13 a_min = minute * 2 *... 阅读全文
posted @ 2014-04-03 21:46 一颗向上的草莓 阅读(138) 评论(0) 推荐(0) 编辑