- 博客(18)
- 资源 (1)
- 收藏
- 关注
转载 C三种整数类型 short, long, int
1. 其它整数类型 int 是 C 语言的基本整数类型,可以满足我们处理一般数据的需求。C 语言还提供了四个可以修饰 int 的关键字:short、long、signed,以及 unsigned。利用这四个关键字,C 语言标准定义了以下整数类型: 1) short int(可简写为 short),和 int 一样,也是有符号整数 2) long int(简
2013-01-26 17:55:21 3667
转载 const 用法 C++
一 const基础 如果const关键字不涉及到指针,我们很好理解,下面是涉及到指针的情况: int b = 500; const int* a = &b; [1] int const *a = &b; [2] int* const
2013-01-18 19:08:07 399
原创 How to get file extension from string in C++
#include #includeint main(){ std::string fn = "filename.conf"; if(fn.substr(fn.find_last_of(".") + 1) == "conf") { std::cout "Yes..." std::endl; } else { std::cout "No..." std::e
2013-01-18 17:08:10 599
转载 ofstream 和 ifstream 用法
ofstream是从内存到硬盘,ifstream是从硬盘到内存,其实所谓的流缓冲就是内存空间;在C++中,有一个stream这个类,所有的I/O都以这个“流”类为基础的,包括我们要认识的文件I/O,stream这个类有两个重要的运算符:1、插入器( 向流输出数据。比如说系统有一个默认的标准输出流(cout),一般情况下就是指的显示器,所以,cout2、析取器(>>)
2013-01-17 19:47:59 405
转载 srd::string 用法 C++
标准C++库字符串类std::string的用法#includestd::string s1;std::string s3(s2);std::string s2("this is a string");begin 得到指向字符串开头的Iteratorend 得到指向字符串结尾的Iteratorrbegin 得到指向反向字符串开头的It
2013-01-17 18:04:18 795
转载 getline C++
Same as getline(input, str, input.widen(’\n’)), that is, the default delimiter is the endline character.
2013-01-17 17:42:01 510
转载 find substring C++
Perhaps the following:if (std::string::npos != s1.find(s2)){ std::cout "found!" std::endl;}
2013-01-17 17:29:47 1037
转载 Jaccard index and dice coifficient
he Jaccard index, also known as the Jaccard similarity coefficient (originally coined coefficient de communauté by Paul Jaccard), is a statistic used for comparing the similarity and diversity of sa
2013-01-17 13:05:04 3100
转载 printf 用法
formatC string that contains the text to be written to stdout.It can optionally contain embedded format specifiers that are replaced by the values specified in subsequent additional arguments and fo
2013-01-11 20:09:17 768
转载 strdup() Copy string
It's effectively doing the same as the following code:char *strdup (const char *s) { char *d = malloc (strlen (s) + 1); // Space for length plus nul if (d == NULL) return NULL; //
2013-01-10 20:26:00 368
转载 Can a member function template be virtual?
Templates are all about the compiler generating code at compile-time. Virtual functions are all about the run-time system figuring out which function to call at run-time.Once the run-time system
2013-01-10 18:31:37 664
转载 Convert a String In C++ To Upper or Lower Case
#include #include std::string str = "Hello World";std::transform(str.begin(), str.end(),str.begin(), ::toupper);#include #include std::string data = "Abc"; std::transform(data.begin(),
2013-01-08 18:44:15 6299
转载 itk Casting and Intensity Mapping
1 Linear Mappings主要的类:itk::CastImageFilter;itk::RescaleIntensityImageFilter;itk::ShiftScaleImageFilter;itk::NormalizeImageFilter.以上四个类的变换规则分别是: (1) itk::CastImageFilter:
2013-01-08 17:25:43 1329
转载 C++ type cast
static_cast is used for cases where you basically want to reverse an implicit conversion, with a few restrictions and additions. static_cast performs no runtime checks. This should be used if you
2013-01-04 17:43:58 1554
转载 Nonconstant parameter for a template class
Templates are strictly a compile-time concept. After compilation, they're baked in and cannot be changed. You cannot use information only known at runtime as a template parameter.
2013-01-04 16:58:16 428
转载 Qt Creator Default Keyboard Shortcuts
General Keyboard ShortcutsActionKeyboard shortcutOpen file or projectCtrl+ONew file or projectCtrl+NOpen in external editorAlt+V, Alt+ICutCtrl+X
2013-01-04 13:59:45 921
转载 Useful GCC flags for C
Several of the -f code generation options are interesting:The -ftrapv function will cause the program to abort on signed integer overflow (formally "undefined behaviour" in C).-fverb
2013-01-01 22:06:59 662
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人