Mercurial > hg > Members > nobuyasu > SampleSource
view boost-spirit/Compiler-boost-spirit/test.txt @ 0:db40c85cad7a default tip
upload sample source
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 May 2011 03:11:59 +0900 |
parents | |
children |
line wrap: on
line source
// テスト void sub1(int &a[], int n) { int i; for (i=0; i<n; i+=1) { a[i] = i * 2; } } void print_sub(string str, int &a) { print(str + str(a) + "です。\n"); } void sub2(int &a[], int n) { int i; for (i=0; i<n; i+=1) { print_sub("a[" + str(i) + "] = ", a[i]); } } /* void sub2(int &a[], int n) { int i; for (i=0; i<n; i+=1) { print("a[" + str(i) + "] = " + str(a[i]) + "です。\n"); } } */ int main() { int value[10]; sub1(value, 10); sub2(value, 10); return 0; } /* int sub(int &a, int &b); int global; int main() { int value; value = 10; global = 20; print("sub(10, 20)の結果は" + str(sub(value, global)) + "です。\n"); print("value = " + str(value) + "です。\n"); print("global = " + str(global) + "です。\n"); return sub(value, global); } int sub(int &a, int &b) { b += 10; return a; } */ /* int main() { int a, b; a = 10; b = 0; if (a > b && b == 0) { print("真\n"); } else { print("偽\n"); } return 0; } */