C++
lynn_0909
这个作者很懒,什么都没留下…
展开
-
C/C++:getopt() getopt_long() getopt_long_only
命令行选项解析函数(C语言):getopt()和getopt_long()正规点的大型程序一般第一步就是处理命令行参数的,接着才是主干程序while((c = getopt_long (argc, argv, short_options, long_options, NULL)) != -1)getopt_long 只是getopt的增强版,功能多点getoptgetopt函数用来解析...转载 2019-07-03 16:13:14 · 640 阅读 · 0 评论 -
用法C++ :c++ 命名空间 IplImage和Mat区别 Mat类用法 copyMakeBorder
#include <iostream>using namespace std;int main(){ cout << "Hello, world!" << endl; return 0;}#include <unistd.h>#include <fcntl.h>#include <stdio.h>#...原创 2019-07-03 21:43:49 · 954 阅读 · 0 评论 -
C++文件操作:fopen / fread / fwrite函数介绍及参数说明
fopen( )打开文件包含头文件: #include<stdio.h>格式:FILE * fopen(const char * path,const char * mode) 参数: path:需要打开的文件路径 mode:文件打开方式mode functionr 以只读方式打开文件,该文件必须存在。r+ 以可读写方式打开文件,该文件必须存在。rb+ 读...原创 2019-07-03 22:10:48 · 1070 阅读 · 0 评论 -
C/C++:计时函数 gettimeofday()
gettimeofday() linux环境下的计时函数,int gettimeofday ( struct timeval * tv , struct timezone * tz )gettimeofday()会把目前的时间有tv所指的结构返回,当地时区的信息则放到tz所指的结构中.//timeval结构定义为:struct timeval{long tv_sec; /*秒*/lo...原创 2019-07-03 22:15:58 · 2114 阅读 · 0 评论 -
c++常用取整方式
floor( )函数向下(负无穷方向)取整 eg: floor(-1.3)=-2; floor(1.3)=1ceil( )函数向上(正无穷方向)取整 eg: floor(-1.3)=-1; floor(1.3)=2fix( )函数朝零方向取整,如fix(-1.3)=-1; fix(1.3)=1;round( )函数四舍五入取整 eg: floor...原创 2019-07-31 18:20:43 · 583 阅读 · 0 评论 -
c++工程内不同文件的函数调用
一个工程里只能有一个main函数,不同文件的函数之间可以相互调用,写个头文件就可以下面举个例子介绍:main.cpp#include <iostream># include "trytry.h" /*包含的头文件*/using namespace std;int hello();int main(){ cout << "hello" <...原创 2019-07-27 11:41:12 · 2948 阅读 · 0 评论