随笔分类 - C++
摘要:最近在做文件IO读写相关的工作,以前一直对printf、fwrite和c++的write不是特别熟悉,写个随笔记录下。 fprintf int fprintf( FILE *stream, const char *format, ... ); Loads the data from the give
阅读全文
摘要:C语言提供了malloc和free两个系统函数,完成对堆内存的申请和释放,malloc/free是库函数,需要头文件支持。而C++则提供了两个关键字new和delete,需要编译器支持。 1、new和delete C++中,用new和delete动态创建数组或单个对象,new表达式返回指向该新创健对
阅读全文
摘要:std::stringstream::str // stringstream::str #include <string> // std::string #include <iostream> // std::cout #include <sstream> // std::stringstream,
阅读全文
摘要:资料来源于:https://en.cppreference.com/w/cpp/algorithm/upper_bound upper_bound()和lower_bound()利用二分查找的方法在有序数组里面进行查找。 upper_bound() template< class ForwardIt
阅读全文