ia

C# 判断数组中是否存在某个值

匿名 (未验证) 提交于 2019-12-03 00:14:01
方法1 1 int[] ia = {1,2,3}; 2 int id = Array.IndexOf(ia,1); // 这里的1就是你要查找的值 1 string[] strArr = {"a","b","c","d","e"}; 2 bool exists = ((IList)strArr).Contains("a"); 参考网址   [1] https://www.cnblogs.com/superelement/p/7691229.html 来源:博客园 作者: lyj00436 链接:https://www.cnblogs.com/luyj00436/p/11653343.html

c++笔记――几种二维数组的遍历方式

匿名 (未验证) 提交于 2019-12-03 00:05:01
先看一个一维数组的简洁遍历方式: int a [ 6 ] ={ 8 , 2 , 1 , 3 , 4 , 5 }; for ( auto & e : a ) cout << e << " " ; 再看二维数组的遍历常用方式: int ia [ 3 ] [ 4 ] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 } ; //1 for ( auto & row : ia ) { for ( auto & col : row ) { cout << col << endl ; } } //2 constexpr size_t rowCnt = 3 , colCnt = 4 ; for ( size_t i = 0 ; i != rowCnt ; ++ i ) { for ( size_t j = 0 ; j != colCnt ; ++ j ) { cout << ia [ i ] [ j ] << endl ; } } //3 for ( int ( * p ) [ 4 ] = ia ; p != ia + 3 ; p ++ ) { for ( int * q = * p ; q != * p + 4 ; q ++ ) { cout << * q << endl ; } } //4 (与3基本相同) for ( int ( * p

C函数篇(pthread_t结构)

馋奶兔 提交于 2019-11-27 11:20:07
linux下是这样定义的: 在linux的实现中pthread_t被定义为 "unsigned long int",参考http://condor.depaul.edu/glancast/443class/docs/pthreads.html Windows下这样定义: 1 /* 2 * Generic handle type - intended to extend uniqueness beyond 3 * that available with a simple pointer. It should scale for either 4 * IA-32 or IA-64. 5 */ 6 typedef struct { 7 void * p; /* Pointer to actual object */ 8 unsigned int x; /* Extra information - reuse count etc */ 9 } ptw32_handle_t; 10 typedef ptw32_handle_t pthread_t; 转载于:https://www.cnblogs.com/sky-of-chuanqingchen/p/4123413.html 来源: https://blog.csdn.net/weixin_30378311/article/details

boost serialization

拟墨画扇 提交于 2019-11-27 05:26:02
Archive An archive is a sequence of bytes that represented serialized C++ objects. Objects can be added to an archive to serialize them and then later loaded from the archive. 1. boost::archive::text_iarchive #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <iostream> #include <fstream> using namespace boost::archive; void save() { std::ofstream file("archive.txt"); text_oarchive oa{file}; int i = 1; oa << i; } void load() { std::ifstream file("archive.txt"); text_iarchive ia{file}; int i = 0; ia >> i; std::cout << i << std::endl; } int main() {