上一页 1 2 3 4 5 6 7 8 ··· 10 下一页

2014年8月11日

摘要: 【题目】猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个,第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。#includeusing namespace std;int main()... 阅读全文
posted @ 2014-08-11 16:56 Ji_xiaowu 阅读(145) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){ float sum=0;//注意声明成浮点型 float n=100.0; for(int i=1;i<=10;i++) { sum+=n; n=n*0.5; }... 阅读全文
posted @ 2014-08-11 16:55 Ji_xiaowu 阅读(192) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){ int m,n,Max; int temp1,temp2; cout>m>>n; Max=(m>n)?m:n; for(int i=1;i<Max;i++) { if(m... 阅读全文
posted @ 2014-08-11 16:54 Ji_xiaowu 阅读(184) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int isPrime(int);int main(){ int n; cout>n; cout<<n<<"="; for(int i=1;i<=n;i++) { if(n%i==0) ... 阅读全文
posted @ 2014-08-11 16:52 Ji_xiaowu 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 【原理】首先在未排序的数列中找到最小(or最大)元素,然后将其存放到数列的起始位置;接着,再从剩余未排序的元素中继续寻找最小(or最大)元素,然后放到已排序序列的末尾。以此类推,直到所有元素均排序完毕。【复杂度和稳定性】(1)选择排序时间复杂度选择排序的时间复杂度是O(N2)。假设被排序的数列中有N... 阅读全文
posted @ 2014-08-11 11:18 Ji_xiaowu 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 【原理】它是一种较简单的排序算法。它会遍历若干次要排序的数列,每次遍历时,它都会从前往后依次的比较相邻两个数的大小;如果前者比后者大,则交换它们的位置。这样,一次遍历之后,最大的元素就在数列的末尾。 采用相同的方法再次遍历时,第二大的元素就被排列在最大元素之前。重复此操作,直到整个数列都有序为止。【... 阅读全文
posted @ 2014-08-11 10:09 Ji_xiaowu 阅读(218) 评论(0) 推荐(0) 编辑

2014年8月9日

摘要: (1)我的错误程序:#include#includeusing namespace std;int ZhuanHuan(char);int main(){ char a[100]; cout>a; for(int i=0;i='a'&&index='A'&&index#includ... 阅读全文
posted @ 2014-08-09 16:57 Ji_xiaowu 阅读(780) 评论(0) 推荐(0) 编辑
摘要: //1、建立一个for循环用于输入数据,设置退出条件//2、算出平均成绩#includeusing namespace std;int main(){ int Score,sum=0,k=0; int a[100]; float Average; cout>Score; ... 阅读全文
posted @ 2014-08-09 15:57 Ji_xiaowu 阅读(5347) 评论(0) 推荐(0) 编辑
摘要: ​#includeusing namespace std;int main(){ int x,y; char a; cout>x>>y; cout>a; switch(a)//switch函数的参数还可用字符 { case '+': cout<<"x... 阅读全文
posted @ 2014-08-09 15:40 Ji_xiaowu 阅读(5055) 评论(0) 推荐(0) 编辑
摘要: ​//1、运用到strlen函数取得输入字符串的长度//2、输出时注意数组下标#include#includeusing namespace std;int main(){ int temp; char a[20]; cout>a; temp=strlen(a); fo... 阅读全文
posted @ 2014-08-09 15:39 Ji_xiaowu 阅读(299) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页

导航