上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: Formatted OutputThe printf functions provide formatted output conversion.int fprintf(FILE *stream, const char *format, ...)fprintf converts and writes output to stream under the control of format. The return valueis the number of characters written, or negative if an error occurred.int printf(const 阅读全文
posted @ 2013-03-20 22:32 freewater 阅读(201) 评论(0) 推荐(0) 编辑
摘要: File OperationsThe following functions deal with operations on files. The type size_t is the unsigned integraltype produced by the sizeof operator.FILE *fopen(const char *filename, const char *mode)fopen opens the named file, and returns a stream, or NULL if the attempt fails. Legalvalues for mode i 阅读全文
posted @ 2013-03-20 21:49 freewater 阅读(305) 评论(0) 推荐(0) 编辑
摘要: C/C++对时间的操作也有许多值得大家注意的地方。最近,在技术群中有很多网友也多次问到过C++语言中对时间的操作、获取和显示等等的问题。下面,在这篇文章中,笔者将主要介绍在C/C++中时间和日期的使用方法. 通过学习许多C/C++库,你可以有很多操作、使用时间的方法。但在这之前你需要了解一些“时间”和“日期”的概念,主要有以下几个: Coordinated Universal Time(UTC):协调世界时,又称为世界标准时间,也就是大家所熟知的格林威治标准时间(Greenwich Mean Time,GMT)。比如,中国内地的时间与UTC的时差为+8,也就是UTC+8。美国是UTC-5。 C 阅读全文
posted @ 2013-03-13 12:25 freewater 阅读(536) 评论(0) 推荐(0) 编辑
摘要: all_ofReturns true when a condition is present at each element in the given range.template<class InputIterator, class Predicate> bool all_of( InputIterator _First, InputIterator _Last, BinaryPredicate _Comp );any_ofReturns true when a condition is present at least once i... 阅读全文
posted @ 2013-03-11 17:12 freewater 阅读(213) 评论(0) 推荐(0) 编辑
摘要: inplace_mergeCombines the elements from two consecutive sorted ranges into a single sorted range, where the ordering criterion may be specified by a binary predicate.template<class BidirectionalIterator> void inplace_merge( BidirectionalIterator _First, BidirectionalIterator _Middle, ... 阅读全文
posted @ 2013-03-11 16:31 freewater 阅读(284) 评论(0) 推荐(0) 编辑
摘要: sortArranges the elements in a specified range into a nondescending order or according to an ordering criterion specified by a binary predicate.template<class RandomAccessIterator> void sort( RandomAccessIterator first, RandomAccessIterator last );template<class RandomAccessIterator, ... 阅读全文
posted @ 2013-03-11 16:21 freewater 阅读(250) 评论(0) 推荐(0) 编辑
摘要: random_shuffleRearranges a sequence of N elements in a range into one of N! possible arrangements selected at random.template<class RandomAccessIterator> void random_shuffle( RandomAccessIterator _First, RandomAccessIterator _Last ); template<class RandomAccessIterator, class Rand... 阅读全文
posted @ 2013-03-11 16:02 freewater 阅读(600) 评论(0) 推荐(0) 编辑
摘要: next_permutationReorders the elements in a range so that the original ordering is replaced by the lexicographically next greater permutation if it exists, where the sense of next may be specified with a binary predicate.template<class BidirectionalIterator> bool next_permutation( Bidirectio... 阅读全文
posted @ 2013-03-11 15:59 freewater 阅读(195) 评论(0) 推荐(0) 编辑
摘要: uniqueRemoves duplicate elements that are adjacent to each other in a specified range.template<class ForwardIterator> ForwardIterator unique( ForwardIterator _First, ForwardIterator _Last );template<class ForwardIterator, class Predicate> ForwardIterator unique( ForwardIterator... 阅读全文
posted @ 2013-03-11 11:29 freewater 阅读(338) 评论(0) 推荐(0) 编辑
摘要: transformApplies a specified function object to each element in a source range or to a pair of elements from two source ranges and copies the return values of the function object into a destination range.template<class InputIterator, class OutputIterator, class UnaryFunction> OutputIterator tr 阅读全文
posted @ 2013-03-11 11:23 freewater 阅读(330) 评论(0) 推荐(0) 编辑
摘要: rotateExchanges the elements in two adjacent ranges.template<class ForwardIterator> void rotate( ForwardIterator _First, ForwardIterator _Middle, ForwardIterator _Last );rotate_copyExchanges the elements in two adjacent ranges within a source range and copies the result to ... 阅读全文
posted @ 2013-03-11 11:15 freewater 阅读(235) 评论(0) 推荐(0) 编辑
摘要: reverseReverses the order of the elements within a range.template<class BidirectionalIterator> void reverse( BidirectionalIterator _First, BidirectionalIterator _Last );reverse_copyReverses the order of the elements within a source range while copying them into a destination range... 阅读全文
posted @ 2013-03-11 11:13 freewater 阅读(236) 评论(0) 推荐(0) 编辑
摘要: replaceExamines each element in a range and replaces it if it matches a specified value.template<class ForwardIterator, class Type> void replace( ForwardIterator _First, ForwardIterator _Last, const Type& _OldVal, const Type& _NewVal );replace_ifExamines each element ... 阅读全文
posted @ 2013-03-11 11:10 freewater 阅读(492) 评论(0) 推荐(0) 编辑
摘要: removeEliminates a specified value from a given range without disturbing the order of the remaining elements and returning the end of a new range free of the specified value.template<class ForwardIterator, class Type> ForwardIterator remove( ForwardIterator _First, ForwardIterator _L... 阅读全文
posted @ 2013-03-11 11:05 freewater 阅读(542) 评论(0) 推荐(0) 编辑
摘要: partitionClassifies elements in a range into two disjoint sets, with those elements satisfying a unary predicate preceding those that fail to satisfy it.template<class BidirectionalIterator, class Predicate> BidirectionalIterator partition( BidirectionalIterator _First, BidirectionalIte... 阅读全文
posted @ 2013-03-11 10:22 freewater 阅读(422) 评论(0) 推荐(0) 编辑
摘要: mergeCombines all of the elements from two sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.template<class InputIterator1, class InputIterator2, class OutputIterator> OutputIterator merge( InputIterator1 _First... 阅读全文
posted @ 2013-03-11 10:19 freewater 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 汇总打印集合的方法1. for_eachtemplate<class T>struct display{ void operator()(const T& val){ cout<<val<<' '; }};int main(){ vector<int> vec(10); iota(vec.begin(),vec.end(),1); random_shuffle(vec.begin(),vec.end()); for_each(vec.begin(),vec.end(),display<int>()); cout 阅读全文
posted @ 2013-03-11 09:58 freewater 阅读(218) 评论(0) 推荐(0) 编辑
摘要: for_eachApplies a specified function object to each element in a forward order within a range and returns the function object.template<class InputIterator, class Function> Function for_each( InputIterator _First, InputIterator _Last, Function _Func ); 阅读全文
posted @ 2013-03-11 09:48 freewater 阅读(147) 评论(0) 推荐(0) 编辑
摘要: includesTests whether one sorted range contains all the elements contained in a second sorted range, where the ordering or equivalence criterion between elements may be specified by a binary predicate.template<class InputIterator1, class InputIterator2> bool includes( InputIterator1 _First1... 阅读全文
posted @ 2013-03-11 09:43 freewater 阅读(287) 评论(0) 推荐(0) 编辑
摘要: countReturns the number of elements in a range whose values match a specified value.template<class InputIterator, class Type> typename iterator_traits<InputIterator>::difference_type count( InputIterator _First, InputIterator _Last, const Type& _Val );count_ifReturns the number ... 阅读全文
posted @ 2013-03-07 16:23 freewater 阅读(225) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页