#include "stdafx.h"#include "iostream"using namespace std;//参数为 数组指针,开始下标, 结束下标, 第K大数(k从0开始)int rand_par(int array[], int start, int end, int th){ if....
分类:
编程语言 时间:
2015-05-23 06:24:36
阅读次数:
153
Description
输入一长度为n的字符串,若其n为偶数,则将字符串从中间反转,若为奇数,则将前后各(n-1)/2个字符反转,中间字符不动。
/* All rights reserved.
* 文件名称:test.cpp
* 作者:陈丹妮
* 完成日期:2015年 5 月 21 日
* 版 本 号:v1.0
*/
#include
#include ...
分类:
编程语言 时间:
2015-05-21 14:16:57
阅读次数:
132
编写函数is_LeapYear实现其参数是否是闰年的判断,如果参数是闰年则返回1,如果不是闰年返回0。
在主函数输入年,调用函数is_LeapYear来进行判断是否是闰年,根据判断结果输出该年的二月份有几天。
/* All rights reserved.
* 文件名称:test.cpp
* 作者:陈丹妮
* 完成日期:2015年 5 月 21 日
* 版 本 号:v1.0
...
分类:
编程语言 时间:
2015-05-21 14:16:50
阅读次数:
441
C/C++如何复制文件
转载请注明出处
C++复制文件要用到输入输出流,关于这个,请参考这篇文章,里面详细介绍了ofstream和ifstream的用法。
http://http://blog.csdn.net/carvin_zh/article/details/45818403
以下就是复制文件的代码:
#include
#include
#...
分类:
编程语言 时间:
2015-05-21 09:16:19
阅读次数:
207
LinuxC++中main(intargc,char**argv),./test运行程序后会自动监测有几个参数,各个参数是什么。程序如下:1#include<iostream>2usingnamespacestd;34intmain(intargc,char**argv)5{6cout<<argc<<","<<argv[2]<<endl;7cout<<"hehl"<<..
分类:
编程语言 时间:
2015-05-20 02:14:32
阅读次数:
133
#include<stdio.h>
#include<time.h>
#include<sys/time.h>
#include<string.h>
#include<iostream>
usingnamespacestd;
char*GetTime(char*pszTime)
{
charszTempTime[222]={0};
time_tt=time(NULL);
structtm*Local=localtime(&t);
struct..
分类:
其他好文 时间:
2015-05-19 16:53:06
阅读次数:
224
Description
给出一串字符,要求统计出里面的字母、数字、空格以及其他字符的个数。字母:A, B, ..., Z、a, b, ..., z组成数字:0, 1, ..., 9 空格:" "(不包括引号) 剩下的可打印字符全为其他字符。
Input
测试数据有多组。每组数据为一行(长度不超过100000)。数据至文件结束(EOF)为止。
Output
每组输入对应...
分类:
编程语言 时间:
2015-05-19 14:54:35
阅读次数:
139
1011. Lenny's Lucky Lotto
Time Limit: 1sec Memory Limit:32MB
Description
Lenny likes to play the game of lotto. In the lotto game, he picks a list of N u...
分类:
其他好文 时间:
2015-05-19 14:51:52
阅读次数:
129
Description
如果a的因子和等于b,b的因子和等于a,且a≠b,则称a,b为亲密数对。比如220的所有真约数(即不是自身的约数)之和为: 1+2+4+5+10+11+20+22+44+55+110=284。 284的所有真约数和为: 1+2+4+71+142=220。你的任务就编写一个程序,判断给定的两个数是否是亲和数
Input
输入数据第一行包含一个数M,接下有M行,每行一...
分类:
编程语言 时间:
2015-05-19 14:51:38
阅读次数:
692
1119. Factstone Benchmark
Time Limit: 1sec Memory Limit:32MB
Description
Amtel has announced that it will re...
分类:
其他好文 时间:
2015-05-19 14:48:12
阅读次数:
131