摘要: #include #include int Is_Prime(int); //申明 int main() { int sum=0; for(int i=45;i<=119;i++) //从45到119 循环 { if(Is_Prime(i)) //是否为素数,若是加进sum,反之判断下一个 sum+... 阅读全文
posted @ 2016-07-15 16:36 爱蜗牛的神牛 阅读(238) 评论(0) 推荐(0) 编辑
摘要: #include #include //删除字符串头部的空白字符。int main(){ char code[]=" hello World"; // int len=sizeof(code); char buf[16]; int count=0; int i=0; for(i=... 阅读全文
posted @ 2016-01-22 20:43 爱蜗牛的神牛 阅读(391) 评论(0) 推荐(0) 编辑
摘要: #include #include //去重int main(){ int initArr[8]={1,3,4,1,8,4,5,3}; //原始数组 int initArrLen=sizeof(initArr)/sizeof(int); //原始数... 阅读全文
posted @ 2016-01-18 21:01 爱蜗牛的神牛 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include #include //设计表决算法//有5个人投票,当有3个或以上的人同意时,投票通过。int main(){ char voter[]={'A','B','C','D','E'}; //5个选举人 int agreeCo... 阅读全文
posted @ 2016-01-12 20:56 爱蜗牛的神牛 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 3 //给定一个数组,将所有的元素在一行里打印出来,中间以逗号分开。注意,末尾不要加逗号。 4 5 int main() 6 { 7 int buf[5] = { 1, 2, 3, 4, 5}; //给定的数组buf 8 int bu... 阅读全文
posted @ 2016-01-07 12:14 爱蜗牛的神牛 阅读(1182) 评论(0) 推荐(0) 编辑
摘要: #include //找出2个数组相同的项,并将其保存在另外一个数组中int main(){ int buf1[]={1,2,3}; int buf2[]={2,3,4}; int des[3]; int count=0; f... 阅读全文
posted @ 2016-01-07 12:04 爱蜗牛的神牛 阅读(508) 评论(0) 推荐(0) 编辑