program

BASIC活用研究目次

http://homepage2.nifty.com/kasayan/bindex.htm

Visual C++ 2005 Express Edition

Beta 2 日本語版 http://www.microsoft.com/japan/msdn/vstudio/express/visualc/

Eclipse

is an open source community whose projects are focused on providing an extensible development platform and application frameworks for building software. Eclipse provides extensible tools and frameworks that span the software development li…

ファイルハンドルをメンバ変数にする

C++ #include class A_class { protected: std::ofstream file2;public: A_class() { std::ofstream file1("file1.txt"); file1 file2.open("file2.txt"); file2 } ~A_class() { file2.close(); } void sayhello() { // file1 file2 } };int main() { class …

小数点以下四捨五入

round (off) 〜 to the (nearest) integer #include int f(double x) {return int(floor( 0.5 + x )) ;}http://www.geocities.jp/bananajuku/r_c/floor.html

それゆけ西表島

ピーターの法則という有名な法則がある。「社会はあらゆるポストが無能な人間によって占められて安定する。」という趣旨の法則だが、有能な人は無能になるまで昇進し続けるので、役職的に無能な人ばっかりになるという恐ろしい法則だ。 人が増えてきたら管理…

easiest generation of a random number

#include #include int main() { srand( time(NULL) ); for(int i=0; i std::cout return 0; }http://www.cppreference.com/stdother/rand.html http://www.cppreference.com/stdother/srand.html

For ループの N回に x回何かを実行したい場合

// == x_times_every_N.cc // For ループの N回に x回何かを実行したい場合#include const int N = 7 ; const int X = 3 ;int main() { for (int i = 0; i { if(i % N >= 0 && i % N { std::cout } } std::cout return 0 ; } 0 1 2 7 8 9 14 15 16 21 22 23 …

ファイル名変更

Ruby ファイル名変換スクリプト 動作を確認したら, $ ./filename.rb ab xy | sh というように,シェルに結果を引き渡すことにより実際にファイル名の変更が可能です. http://www.ecs.shimane-u.ac.jp/~nawate/lecture/gairon02/6-18/6-18.html

Intel C++ compiler

manual downloads http://www.intel.com/software/products/compilers/clin/docs/manuals.htm ・rpm が無いとインストールできない

二次元配列の動的なmemory allocation(C++)

#include int main() { int **a ; int *p ; p = new int[1000] ; std::cout for(int i = 0; i a[i] = p + 200 * i ; for(int i = 0; i std::cout for(int i = 0; i { for(int j = 0; j { a[i][j] = (i+1) * (j+1) ; std::cout } } delete [] p ; return 0 ; …

definition of "clean" in a Makefile

clean: rm -f $(OFILES)

the DRY Principle

Don't Repeat Yourself Duplication (inadvertent or purposeful) can lead to maintenance nightmares, poor factoring, and logical contradictions. http://c2.com/cgi/wiki?DontRepeatYourself http://www.artima.com/intv/dry.html

cygwinのperlにバグ

code working on 5.6.1 in cygwin on binary mount files breaks on 5.8.0. http://d.hatena.ne.jp/svnseeds/20030527 http://www.mhonarc.org/archive/html/mhonarc-users/2002-08/msg00064.html

計算材料科学プログラムソースコード

分子動力学法/Tight-Binding法 etc. http://www.fml.t.u-tokyo.ac.jp/~izumi/CMS/program.htm

Embrace Change

an attitude assumed in ExtremeProgramming and the subtitle of KentBeck's manifesto on the same http://c2.com/cgi/wiki?EmbraceChange http://www.objectclub.jp/community/XP-jp/xp_relate/essential-ec

FORTRANの歴史

http://members.at.infoseek.co.jp/kitaurawa/fortran.html

標準C++ namespaceについて

http://fujitake.dip.jp/sealsoft/namespace.html 名前空間は、空間に名前を付け、その中に型や変数、関数などを入れることで識別名の衝突を防ぐものだ。 #include cout は、最新のC++では正しくない。標準C++のライブラリは名前空間stdの中に宣言されている…

関数ポインタ

を用いて、関数の関数(汎関数、母関数)を作る //== 母関数 void Flux_class::init_adf(double (*adf)(double), double range_min, double range_max, double delta_theta ) { tmp_summation += (*adf)(tmp_theta) ; } //== 関数 double func_cosine(double…

ファイル出力

ファイルハンドルがNULLポインタでないかチェックする void Shape_string_class:: output_surface_charge(ofstream *file) { if(file != NULL ) { for(int i = 0; i { *file surface_charge } } }

階乗を求めるプログラム

をRubyで書くと以下のようになる http://akademeia.info/main/math_lecturez/math_kaijyou.htm

オブジェクト指向プログラミング

http://www.page.sannet.ne.jp/mtoga/lang/cp/bih-p_40.htm フレンド・多重継承 http://mikata.curiocube.com/oop/index.php オブジェクト指向プログラミング(OOP: Object Oriented Programming)のちょっと難しいところを易しく解きほぐしていこうと思います…

線分の交差

線分ABと線分CDが交差していることを確かめるには: 位置ベクトルをそれぞれ文字ABCDで表すと A + t(B - A) = C + s(D - C) を t, s について解いて、 0≦t,s≦1 となれば交差している。

ファイルからの入力

char ch; ifstream fin( "temp.txt" ); while( !fin.eof() ) { fin >> ch; cout } fin.close(); ↑このまま実行すると最後の読み込みが重複する:なぜか?GCCだけか? http://www.cppreference.com/cppio_details.html#eof

データの並べ替え

上記プロジェクトで、鏡面境界条件を用いているのでExcelを用いてデータを並べ替えてコピーする必要がある。 Excelでは データ→並べ替えで順序の入れ替えができるここでは単純に順序を逆にするだけなので、下記のperlスクリプトでも対応可 http://www.rfs.jp…

Perl&CGI プログラミングについてのバイブル

http://www.rfs.jp/sitebuilder/perl/

ループ中、f回に1回実行(fは小数)

#include const double INTERVAL_DECIMAL = 2.5 ;int main() { int interval_step = 0; for(int i=0; i { if(int (double(i) / INTERVAL_DECIMAL) > interval_step ) { interval_step++ ; cout } } }

Hatching functions,

typically used to identify sections, are used to fill a closed area. 塗りつぶしの関数(?) http://www.varicad.com/man/manual15.htm

Ruby で多次元配列

http://www.ir.isas.ac.jp/~masa/ruby/ http://www.ir.isas.ac.jp/~masa/ruby/dist/narray-0.5.7p3.tar.gz インストール方法 Rubyの標準的な拡張ライブラリと同じです。ソースを展開したディレクトリで、 ruby extconf.rb make make site-install (または ma…

C言語講座:ビット演算

http://www1.cts.ne.jp/~clab/Contents/Bitindex.html