eclipseにデバッガをインストール
vectorクラス、動的配列
動的に配列サイズが拡張される
#include <vector> #include <iostream> void printAll(const std::vector<int>&); int main() { using std::vector; vector<int> ary(10); ary[0] = 1; // 配列のような使用が可能 ary.at(1) = 2; // ary[1] = 2とほぼ等価 printAll(ary); ary.resize(2); // 要素数を2に減らす printAll(ary); ary.reserve(20); // 許容量を20に増やす printAll(ary); ary.resize(5, 3); // 要素数を5に増やし、3で初期化 printAll(ary); }
gitへのcommit方法
commitの後にpushするとデータがクラウドにアップデートされる。
commitの段階だとローカルでアップデートされるのみ。
cpp helloworld
#include <iostream> using namespace std; int main() { cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! return 0; }
macでeclipseにcmakeと連動させること [eclipse]
1)cmakeをインストール,https://cmake.org/
コマンドラインで使えるように設定する.GUIのcmakeを開いて設定.
2)eclipse側でprojectでbuildディレクトリを指定.
3)makefileを作りたいフォルダでcmake
01.helloworld kuwakichi$ cmake .
ゴミと一緒にmakefileができてる.
use default command
上のチェックボックスは外すこと.
4)CMakeList.txtの例
cmake_minimum_required(VERSION 2.8) PROJECT(HelloWorld) include_directories ("${PROJECT_SOURCE_DIR}/${sub}") add_definitions("-Wall -std=c++11")