2017年3月28日
摘要: 好久不编写程序的韩璐璐又重新编程,发现很多基础的知识什么的都忘掉了,果然,程序员们要多多编程,勤奋练习。 #include<iostream>#include<cstdio>using namespace std;int main(void){ int n; int a[5][5]; int b[5 阅读全文
posted @ 2017-03-28 16:51 hanlulu 阅读(145) 评论(0) 推荐(0) 编辑
  2017年2月20日
摘要: 最简单的猜数程序是这样的: 用到了rand 函数,整体比较简单。 #include<stdio.h>#include<stdlib.h>int main(){ int magic; int guess; magic=rand(); while(scanf("%d",&guess)==1) { if( 阅读全文
posted @ 2017-02-20 15:57 hanlulu 阅读(216) 评论(0) 推荐(0) 编辑
  2017年2月16日
摘要: #include<iostream>using namespace std;int main(){ char a; int n=5,i,j,k; cin>>a; for(i=1;i<=n;i++)//行数 { for(j=n-i;j>0;j--)//空格数 cout<<" "; for(k=1;k< 阅读全文
posted @ 2017-02-16 17:49 hanlulu 阅读(104) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int main(){ int a,b,c,m=0,s[3]; for(a=1;a<7&&m==0;a++) for(b=0;b<7&&m==0;b++) for(c=1;c<7&&m==0;c++) if((c+b*7+ 阅读全文
posted @ 2017-02-16 00:08 hanlulu 阅读(120) 评论(0) 推荐(0) 编辑
  2017年2月13日
摘要: 如何在很多字符串中找到确定的字符 如果是找第二个特定字符呢。 #include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char a[]="Hello"; char *p=strchr(a,'l'); printf("%s\n" 阅读全文
posted @ 2017-02-13 15:19 hanlulu 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 题目: 如果两个不同的正整数,它们的和是它们积的因子,则称这两个数是兄弟数,小的称弟数,大的称兄数。先后输入 n 和m ,(n<m),在这m-n+1个数中,找兄弟数。没找到的话,输出“No Solution.” 找到的话,判断和最小的一对兄弟数输出。如果,两组兄弟数的和相同,则输出弟数比较小的那一组 阅读全文
posted @ 2017-02-13 12:54 hanlulu 阅读(242) 评论(0) 推荐(0) 编辑
  2017年2月12日
摘要: 第一次碰到while 的这种应用,觉得还是挺不错的想法。 在字符串的输入中经常会遇到这种情况,就是,输入一连串的字符,第一次在整数中遇到这个。 题目:输入若干个不超过100 的正整数,输出最大值,最小值,以及所有数的和。输入零结束。 代码如下: #include<iostream>#include< 阅读全文
posted @ 2017-02-12 22:36 hanlulu 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 太水了太水了,这个题太水了。。。 #include<iostream>#include<cstdio>using namespace std;int main(){ int a; cin >> a; int i; for (i=1;i<=a;i++) { if(a%i==0) cout << i < 阅读全文
posted @ 2017-02-12 20:01 hanlulu 阅读(135) 评论(0) 推荐(0) 编辑
  2017年2月10日
摘要: #include<stdio.h>int divide(int a,int b,int *result);int main(){ int a=5,b=2; int c; if(divide(a,b,&c)) { printf("%d",c); } return 0;}int divide(int a 阅读全文
posted @ 2017-02-10 22:08 hanlulu 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>void minmax(int a[],int len,int *min ,int *max);int main(){ int a[]={1,2,3,4,5,6,7,8,2,4,1,6,8,2,78,2,4,54,4,5,4,61,5,58,55,}; int mi 阅读全文
posted @ 2017-02-10 21:03 hanlulu 阅读(100) 评论(0) 推荐(0) 编辑