Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
soft:c [2020/07/25 09:02] – [函数指针作为参数] Ce Zhangsoft:c [2020/11/05 02:10] (current) Ce Zhang
Line 1: Line 1:
 =====C++===== =====C++=====
 +
 +==== 2D array ====
 +<code>
 +TGraph*** g = new TGraph**[Nfile];
 +for(i loop) g[i] = new TGraph*[t[i]->Nentries];
 +for(int j = 0; j<t[i]->Nentries;j++) g[i][j] = ...(TGraph *)...
 +</code>
 +
 +====EOF====
 +<code>
 +<<EOF        //开始
 +....
 +EOF            //结束
 +
 +//将一个文件的内容输出到另一个文件中:
 +# cat fileA > fileB
 +//将"<< EOF EOF"替代输入对象文件fileA:
 +# cat << EOF > fileB
 +//命令执行后,提示用户输入内容,输入结束后,用户的输入内容被保存到了fileB中。
 +</code>
 +
 ====I/O==== ====I/O====
  
Line 71: Line 92:
     InsideAerogel     InsideAerogel
 ); );
 +</code>
 +
 +====char * 转换 (for input arg.)====
 +<code>
 +//char* to int
 +
 +int a = stoi(argv[1]);
 + 
 +//char* 转 float/double
 +float b = stof(argv[2]);
 +double bb = stod(argv[2]);
 + 
 +//char* 转 string (可以直接转)
 +string str = argv[3];
 +cout << a << endl << b << endl << bb << endl << str << endl;
 </code> </code>