cpp1.dvi

Size: px
Start display at page:

Download "cpp1.dvi"

Transcription

1 2017 c 1 C++ (1) C C++, C++, C 11, (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include <iostream> // C <stdinh> 2: 3: int main(void) { 4: std::cout << "hello" << std::endl; // 5: int n; //, 6: std::cout << "n = "; 7: std::cin >> n; // 8: int s = 0; 9: for (int i=1; i<=n; i++) s += i; 10: std::cout << "sum(1" << n << ") = " << s << std::endl; 11: return 0; 12: } 3: << std::cout, C stdout ( C stderr ( ), C++ std::cerr ) <<, std::endl std::cout << "hello\n"; std::cout << "hello" << std::endl;,,, std::endl, "\n", std::endl 7: >> std::cin, C stdin >>, 9: for int i for 1 1

2 C gcc g++ hellocpp, g++ hellocpp C, Cygwin aexe, Linux Mac OS X aout, /aexe (Cygwin ; exe ) /aout (Linux Mac OS X ), -o, myprog (Cygwin myprogexe), g++ -o myprog hellocpp, ( C printf ) 11 [List 11] ( ),,,, (,,,, int double,,, std:: std::,, using namespace std;, ( ), C++ 12 new delete C malloc(), free(), new delete 1 2

3 [List 12] 1: #include <iostream> 2: 3: int main(void) { 4: int *a = 0; // 5: a = new int; // int 1, 6: *a = 100; 7: std::cout << *a << std::endl; 8: delete a; // 9: return 0; 10: } 4:, C NULL, C++ 0 5: new,, (bad alloc ),,, catch, throw,, new [ ] delete [], n, n [List 13] 1: #include <iostream> 2: 3: int main(void) { 4: int n; 5: std::cin >> n; 6: int* a = new int[n]; // n, 7: // 7: for (int i = 0; i<n; i++) a[i] = i; 8: delete [] a; // delete [] (!) 9: return 0; 10: } new, delete,,,,, (memory leak, memory leakage) 1 3

4 C, (call-by-value) C++, [List 14] 1: #include <iostream> 2: 3: void inc(int x) { // x, 4: x ++; // 1, 5: std::cout << "x = " << x << std::endl; // 6: } 7: 8: int main(void) { 9: int a = 5; 10: inc(a); // a inc, 11: std::cout << "a = " << a << std::endl; // a? 12: return 0; 13: }, x = 6 a = 5, a a, C [List 15] 1: #include <iostream> 2: 3: void inc(int* x) { 4: (*x)++; 5: std::cout << "*x = " << *x << std::endl; 6: } 7: 8: int main(void) { 9: int a = 5; 10: inc(&a); 11: std::cout << "a = " << a << std::endl; 12: return 0; 13: }, *x = 6 a = 6 1 4

5 C++, (call-by-reference), &, ( ) [List 15] C++ [List 16] 1: #include <iostream> 2: 3: void inc(int& x) { // 4: x++; // x * 5: std::cout << "x = " << x << std::endl; 6: } 7: 8: int main(void) { 9: int a = 5; 10: inc(a); // & 11: std::cout << "a = " << a << std::endl; 12: return 0; 13: }, x = 6 a = 6 C++,, inc(&x), x=inc(x), 12 2 x y, x y x, y divrem(int&, int&), 132, C, 133 C, C++,, add 3, 3 1 5

6 [List 17] 1: #include <iostream> 2: 3: int add(int a, int b) {return a+b;} // (1) 4: int add(int a, int b, int c) {return a+b+c;} // (2) 5: double add(double a, double b) {return a+b;} // (3) 6: 7: int main(void) { 8: int x=3, y=4, z=5; 9: double p=314, q=244; 10: std::cout << add(x,y) << std::endl; // (1) 11: std::cout << add(x,y,z) << std::endl; // (2) 12: std::cout << add(p,q) << std::endl; // (3) 13: return 0; 14: } 10 12, add,, C++,, add(int,int), add(int,int,int), add(double,double), C, add 2 add ( ) (overloading), 134 max(int,int) (2, ) [List 18] 1: #include <iostream> 2: 3: int max(int a, int b) {return a>b? a : b;} 4: 5: int main(void) { 6: int x, y, z; : 7: z = max(x+1,y) + 3; : 8: return 0; 9: }, main(void) max(int,int), max(int,int) main(void) 1 6

7 (, ) [List 19] 1: int main(void) { 2: int x, y, z; : 4: z = ((x+1>y)? x+1 : y) + 3; : 5: return 0; 6: },, 1,,,,,,, inline [List 110] 3 : inline int max(int a, int b) {return a>b? a : b;} inline,, #define, inline,, #define max(a,b) ((a)>(b)?(a):(b)),, a = 0; max(++a,0); // a 2? max(++a,10); // a 1? 1, 14 (1) (class), C++, 1 max ( ++a > x? ++a : x ), ++a x ++a 2, 1 1 7

8 141, C struct, [List 111] 1: #include <iostream> 2: #include <asserth> // assert 3: 4: class stack { 5: private: 6: static const int max = 100; 7: int data[max]; 8: int sp; 9: public: 10: void push(int); // 11: void pop(); // 12: bool empty() const; // true 13: int top() const; // 14: int size() const; // 15: stack(); // 16: stack(); // 17: }; (17 ) (;)! (, ) 6 8: max, data[max], sp stack (member) 10 14: (member) (method) push(int d) d pop() empty() top() size() 1, 0 empty(), top(), size() const,, (const, ) push(int) pop(), const ( ) 1 8

9 15 16: stack() stack(), stack() stack (constructor; ) stack(); stack (destructor; ) 5: private, (6 8 ) 9: public, (10 16 ), stack,, public, stack ( ), stack (encupslation of data), 2: <asserth>, assert(bool), 7 [List 112] 1: void stack::push(int d) { 2: assert(sp<max); 3: data[sp++] = d; 4: } 5: 6: void stack::pop() { 7: assert(0<sp); 8: --sp; 9: } 10: 11: bool stack::empty() const { 12: return sp==0; 13: } 14: 15: int stack::top() const { 16: return data[sp-1]; 17: } 18: 19: int stack::size() const { 20: return sp; 21: } 22: 23: stack::stack() {sp = 0;} 24: 25: stack:: stack() {} stack::, stack 2: assert(sp<max);,, sp<max assert ( );, 0, 1 9

10 7: 11, 15, 19: const, const 23:,, 0 25:, (1), [List 113] 1: int main(void) { 2: stack s; // stack 3: spush(5); // s = (5) 4: spush(8); // s = (5 8) 5: spush(9); // s = (5 8 9) 6: std::cout << stop() << std::endl; // 9 7: spop(); // s = (5 8) 8: std::cout << stop() << std::endl; // 8 9: spop(); // s = (5) 10: spush(3); // s = (5 3) 11: std::cout << ssize() << std::endl; // s 2 12: while(!sempty()) { 13: std::cout << stop() << std::endl; 14: spop(); 15: } 16: return 0; 17: } 2: int i; s stack, s push(5), spush(5) (, p, p->push(5) ) s main(void) 13 ([List 111], [List 112], [List 113] ),, (2) int, stack 1 10

11 [List 114] 1: int main(void) { 2: stack* s = new stack; // 3: s->push(5); // ( ) 4: s->push(8); 5: s->push(9); 6: std::cout << s->top() << std::endl; 7: s->pop(); 8: std::cout << s->top() << std::endl; 9: s->pop(); 10: s->push(3); 11: std::cout << s->size() << std::endl; 12: while(!s->empty()) { 13: std::cout << s->top() << std::endl; 14: s->pop(); 15: } 16: delete s; // 17: return 0; 18: } 2: stack s, new ( ) 16: s ( ) stack 142 stack, inline,,,, [List 115] 1: class stack { 2: private: 3: static const int max = 100; 4: int data[max]; 5: int sp; 6: public: 7: void push(int d) {assert(sp<max); data[sp++] = d;} 8: void pop() {assert(0<sp); --sp;} 9: bool empty() const {return sp==0;} 10: int top() const {return data[sp-1];} 11: int size() const {return sp;} 12: stack() {sp = 0;} 13: stack() {} 14: }; 1 11

12 ,, 1 143, (, ) stack, s(n);, n data n s, data [List 115] 12, (sz) [List 116] 121: stack(int sz=100) { 122: sp = 0; 123: max = sz; 124: data = new int[max]; 125: } 121: int sz=100,, 100 new, delete [List 115] 13 [List 117] 13 : stack() {delete [] data;} [List 113] 2, 45 [List 118] 2 : stack s(45);,, stack s; stack s(100); 1 12

13 14, max, 121, max, static const int ( int) ( ), 100, C++, data int data[max] data stack equal(const stack&, const stack&) const, equal(const stack&, const stack&) 2,, true, false ( ) true false 2 bool typedef int bool; const bool false = 0; const bool true = 1;, (stack) (stack&) ( ), stack ( read-only ), const (, ), [List 119] 1: bool equal(const stack& s1, const stack& s2) { 2: bool eq = true; // eq=true, eq=false 3: if (s1sp!=s2sp) eq = false; // 4: else { 5: for (int j=0; j<s1sp && eq; j++) { 6: if (s1data[j]!=s2data[j]) eq = false; 7: // 8: } 9: } 10: return eq; 11: } 10 0,

14 [List 120] 1: int main(void) { 2: stack s1, s2; 3: s1push(5); 4: s1push(8); 5: s1push(9); 6: s2push(5); 7: s2push(8); 8: s2push(9); 9: s2push(10); 10: std::cout << equal(s1,s2) << std::endl; 11: s2pop(); 12: std::cout << equal(s1,s2) << std::endl; 13: return 0; 14: }, ( ) sstack2cpp: In function bool equal(const class stack &, const class stack &) : sstack2cpp:30: member sp is a private member of class stack sstack2cpp:30: member sp is a private member of class stack sstack2cpp:32: member sp is a private member of class stack sstack2cpp:33: member data is a private member of class stack sstack2cpp:33: member data is a private member of class stack, equal(const stack&, const stack&) stack, private,, equal(const stack&, const stack&), 2, public,,, equal(const stack&, const stack&),,,,, 12 friend [List 121] 1: class stack { 2: private: 3: static const int max = 100; 4: int data[max]; 5: int sp; 1 14

15 6: public: 7: void push(int); 8: void pop(); 9: bool empty() const; 10: int top() const; 11: int size() const; 12: friend bool equal(const stack&, const stack&); 13: stack(); 14: stack(); 15: }; 15 stack bool sum equal(const stack&, const stack&),, 2 true, false,, ( ) 15 (2) 2 Complex, real, imag,,, [List 122] 1: class Complex { 2: private: 3: double real; // 4: double imag; // 5: public: 6: Complex() {real = 00; imag = 00;} 7: Complex(double r, double i) {real = r; imag = i;} 8: Complex() {} 9: double re() const {return real;} // 10: double im() const {return imag;} // 11: void set re(double r) {real = r;} // 12: void set im(double i) {imag = i;} // 13: void print(std::ostream& os) const { // 14: os << real << "+" << imag << "i"; 15: } 16: };, a, b, c ( ), 1 15

16 [List 123] 1: int main(void) { 2: Complex a; // 1 3: aset re(111); 4: aset im(222); 5: Complex b(333,444); // 2 6: Complex c; // 3 7: c = Complex(999, 8888); 8: aprint(std::cout); std::cout << std::endl; 9: bprint(std::cout); std::cout << std::endl; 10: cprint(std::cout); std::cout << std::endl; 11: c = a; // 12: cprint(std::cout); std::cout << std::endl; 13: return 0; 14: } 2, Complex() Complex ( 0+0i), 3 4 5, 2 Complex(double, double), 6, 2, 7 Complex 16 [List 122], [List 123],, double r, r 0 Complex(double), main(void) Complex C, add(complex, Complex) [List 124] 1: Complex add(complex a, Complex b) { 2: double r = are() + bre(); 3: double i = aim() + bim(); 4: return Complex(r,i); 5: }, 1 16

17 [List 125] 1: int main(void) { 2: Complex x, y, z, a; 3: x = Complex(100, 200); 4: y = Complex(222, 314); 5: z = Complex(423, 999); 6: a = add(add(x,y),z); 7: xprint(std::cout); std::cout << std::endl; 8: yprint(std::cout); std::cout << std::endl; 9: zprint(std::cout); std::cout << std::endl; 10: aprint(std::cout); std::cout << std::endl; 11: return 0; 12: } C++ /, + -,,, a = add(add(x,y),z); a = x + y + z;, * /, + -,, +, -, *, / [List 126] 1: Complex operator+(complex a, Complex b) { 2: double r = are() + bre(); 3: double i = aim() + bim(); 4: return Complex(r,i); 5: } [List 124] 1 add operator+ operator+ + operator+ 2 operator+, int double operator+ (, ) inline, 17 double Complex, Complex 1 17

18 [List 127] 1: int main(void) { 2: Complex a(100, 200); 3: Complex b(300, 400); 4: Complex c(235, 532); 5: Complex x = 20 * c; 6: xprint(std::cout); std::cout << std::endl; 7: Complex y = a * b; 8: yprint(std::cout); std::cout << std::endl; 9: return 0; 10: } i -5+10i Complex, << <<, +, operator<< [List 128] 1: std::ostream& operator<<(std::ostream& os, Complex& c) { 2: cprint(os); 3: return os; 4: } void std::ostream&, 3 os, (std::cout << "a = " << a << std::endl ) std::ostream, (, ) Complex,, int double 1 18

19 [List 129] 1: int main(void) { 2: Complex a[3]; // a[0], a[1], a[2] 3: a[0] = Complex(100,200); 4: a[1] = a[0] + Complex(000,100); 5: Complex *c = &(a[2]); // c a[2] 6: *c = a[0]; // *c a[2] 7: for (int i=0; i<3; i++) std::cout << a[i] << std::endl; 8: Complex *b = new Complex[3]; // 9: for (int i=0; i<3; i++) b[i] = a[i] + Complex(100,100); 10: for (int i=0; i<3; i++) std::cout << b[i] << std::endl; 11: delete [] b; // b 12: return 0; 13: } 18 [List 129] ( ) 1 Bjarne Stroustrup, ( ) /, C++ [ 3 ], /, ISBN X, 7,000 STL, 1 2 Herbert Schildt,,, C++,, ISBN , 3,200 C++ 3 Gregory Satir, Doug Brown,, C++ /, ISBN , 3,900 C C++ 4 Scott Meyers,, Effective C++ [ 2 ], /, ISBN , 3,800 C, C++ 5 Scott Meyers,,,, More Effective C++, /, ISBN , 3,800 Effective C++ ( ) 6 Andrew Koenig, Barbara E Moo,, C++, /, ISBN , 3,800 C++,

20 1 20 Nagisa ISHIURA

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

cpp4.dvi

cpp4.dvi 2017 c 4 C++ (4) C++, 41, 42, 1, 43,, 44 45, 41 (inheritance),, C++,, 100, 50, PCMCIA,,,,,,,,, 42 1 421 ( ), car 1 [List 41] 1: class car { 2: private: 3: std::string m model; // 4: std::string m maker;

More information

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout << C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello

More information

cpp2.dvi

cpp2.dvi 2018 c 2 C++ (2) STL, C++ 21 string 22 STL 23 21 string C, \0, (, ), (, ), /,,,, C++,,, string string,,,,,, include,,, int, > >>,,,, getline(, string ), [List 21] 2: #include 3: 4:

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( data.t C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout

More information

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10;

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10; (STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector x; for(int i = 0; i < 10; ++i) x.push_back(i); vector STL x.push_back(i) STL

More information

Condition DAQ condition condition 2 3 XML key value

Condition DAQ condition condition 2 3 XML key value Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................

More information

exec.dvi

exec.dvi 2018 c 6, Mini-C C++ 6211 611, 61, print,,, (run ),,, (int ), 7, x, x "a" 3 "b" 4 "x" 10 (, ), x STL map 1 + 2, 1 2,, x = ;, 1, 2 x { 1 ; 2 ; ; m, if ( ) { 1 else { 2, 1,, 2 0, 1, 3 0, 2,,, main 6 1 ,,

More information

解きながら学ぶC++入門編

解きながら学ぶC++入門編 !... 38!=... 35 "... 112 " "... 311 " "... 4, 264 #... 371 #define... 126, 371 #endif... 369 #if... 369 #ifndef... 369 #include... 3, 311 #undef... 371 %... 17, 18 %=... 85 &... 222 &... 203 &&... 40 &=...

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

ワークショップ テスト駆動開発

ワークショップ テスト駆動開発 JUnit 5 5 20 20 FIT 20 FIT FIT 10 IT OO Web XML ADC2003 WG JUnit JUnit 3.8.1 URL: http://www.junit.org/index.htm junit.3.8.1.zip junit.jar c: junit junit.jar javac -classpath c: junit junit.jar JUnitTest.java

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf ("sum=%d n",sum); 2

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf (sum=%d n,sum); 2 アセンブラ (Z80) の例 ORG 100H LD B,10 SUB A LOOP: ADD A,B DEC B JR NZ,LOOP LD (SUM),A HALT ORG 200H SUM: DEFS 1 END 1 C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i

More information

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1 () 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1 C++ 2018 7 1, 2018 11 4 http://nalab.mind.meiji.ac.jp/~mk/labo/text/nantoka-c++/ 1 C++ C C++ C++ C cpprefjp - C++ 1 C++17 2 2 CUI 2.1 donothing.cpp 1 /* 2 * donothing.cpp 3 */ 4 5 int main() 6 7 return

More information

untitled

untitled C++2 1. publicprivate 2. 3. 4. 5. Intelligent Electronic Systems Group protected Carmainmy_car.car_number ca_number //Car class Car int car_number; // void showgas( ); // double gas; // void shownumber(

More information

Parametric Polymorphism

Parametric Polymorphism ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x

More information

programmingII2019-v01

programmingII2019-v01 II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

- - http://168iroha.net 018 10 14 i 1 1 1.1.................................................... 1 1.................................................... 7.1................................................

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

tuat2.dvi

tuat2.dvi ( 2 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 7 7 ( 2 ) 1 / 54 (1) (2) (?) (1) (2) 2 ( 2 ) 2 / 54 1. 30 2. 2012 6 30 25 OS ( 2 ) 3 / 54 10 20 1993 1996 2000 2003 = 30 ( 2 ) 4 / 54 1 2 2 ( 2 ) 5 /

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

design_pattern.key

design_pattern.key #include void init(int* ary, int size) for (int i = 0; i < size; ++i) ary[i] = i; void mul10(int* ary, int size) for (int i = 0; i < size; ++i) ary[i] *= 10; void dispary(int* ary, int size)

More information

I 2 tutimura/ I 2 p.1/??

I 2   tutimura/ I 2 p.1/?? I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,

More information

2008chom.pdf

2008chom.pdf CHomP Pawe l Pilarczyk 1 CHomP Computational Homology Project [3] OS Windows Mac Unix Linux [3] CHomP [3] 2 3 CHomP CHomP 4 5 C++ [1] 2 CHomP 1 2 K 1 = { A 1 A 2 A 3, A 1 A 2, A 2 A 3, A 1 A 3, A 3 A 4,

More information

4 5 6 CHAPTER 1 1 1-1 n % i n = 3 m = 10 k = {1, 3, 5 Yes 1, 1, 3, 5 10 n = 3 m = 9 k = {1, 3, 5 No 9 8 1-1 #include const int MAX_N = 50; int main() { int n, m, k[max_n]; // scanf("%d %d", &n,

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

2 T 1 N n T n α = T 1 nt n (1) α = 1 100% OpenMP MPI OpenMP OpenMP MPI (Message Passing Interface) MPI MPICH OpenMPI 1 OpenMP MPI MPI (trivial p

2 T 1 N n T n α = T 1 nt n (1) α = 1 100% OpenMP MPI OpenMP OpenMP MPI (Message Passing Interface) MPI MPICH OpenMPI 1 OpenMP MPI MPI (trivial p 22 6 22 MPI MPI 1 1 2 2 3 MPI 3 4 7 4.1.................................. 7 4.2 ( )................................ 10 4.3 (Allreduce )................................. 12 5 14 5.1........................................

More information

ALG2012-A.ppt

ALG2012-A.ppt 21279 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/212/index.html (, )ε m = n C2 = n ( n 1) / 2 m = n ( n 1) 1 11 11 111 11 111 111 1111 1 1 11 1 11 11 111 4-dimentional

More information

Microsoft PowerPoint - 11.pptx

Microsoft PowerPoint - 11.pptx ポインタと配列 ポインタと配列 配列を関数に渡す 法 課題 : 配列によるスタックの実現 ポインタと配列 (1/2) a が配列であるとき, 変数の場合と同様に, &a[0] [] の値は配列要素 a[0] のアドレス. C 言語では, 配列は主記憶上の連続領域に割り当てられるようになっていて, 配列名 a はその配列に割り当てられた領域の先頭番地となる. したがって,&a[0] と a は同じ値.

More information

1.3 ( ) ( ) C

1.3 ( ) ( ) C 1 1.1 (Data Base) (Container) C++ Java 1.2 1 1.3 ( ) ( ) 1. 2. 3. C++ 2 2.1 2.2 2.3 2 C Fortran C++ Java 3 3.1 (Vector) 1. 2. ( ) 3.2 3 3.3 C++ C++ STL C++ (Template) vector vector< > ; int arrayint vector

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

C 言語経験者のための C++ 入門

C 言語経験者のための C++ 入門 C 言語経験者のための C++ 入門 金森由博 kanamori@cs.tsukuba.ac.jp 2013/4/19 第 1.2 版 2011/7/19 第 1 版 この資料は下記 URL から入手できます http://kanamori.cs.tsukuba.ac.jp/index-ja.html#for_students 1 内容 C++ を学び始めに引っかかりそうなところを概説 この資料の目標は

More information

DiMP Users Manual Yuichi Tazaki

DiMP Users Manual Yuichi Tazaki DiMP Users Manual Yuichi Tazaki 3 1 5 2 7 2.1............................. 7 2.2........................... 7 3 DiMP 9 3.1............................... 9 3.2........................... 10 3.3...................................

More information

VB.NETコーディング標準

VB.NETコーディング標準 (C) Copyright 2002 Java ( ) VB.NET C# AS-IS extremeprogramming-jp@objectclub.esm.co.jp bata@gold.ocn.ne.jp Copyright (c) 2000,2001 Eiwa System Management, Inc. Object Club Kenji Hiranabe02/09/26 Copyright

More information

新・明解C言語で学ぶアルゴリズムとデータ構造

新・明解C言語で学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

6-1

6-1 6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);

More information

untitled

untitled 21174 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/211/index.html tech.ac.jp/k1sakai/lecture/alg/211/index.html html (, )ε m = n C2 = n ( n 1) / 2 m = n ( ( n

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 プログラミングを 余談 : 教えることの難しさ 丁寧に説明しないと分かってもらえない 説明すると 小難しくなる学生が目指すべきところプログラム例を説明されて理解できる違うやり方でも良いので自力で解決できる おっけー 動けば良い という意識でプログラミング 正しく動くことのチェックは必要 解答例と自分のやり方との比較が勉強になる 今日のお題 再帰的構造体

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

11042 計算機言語7回目 サポートページ:

11042 計算機言語7回目  サポートページ: 11042 7 :https://goo.gl/678wgm November 27, 2017 10/2 1(print, ) 10/16 2(2, ) 10/23 (3 ) 10/31( ),11/6 (4 ) 11/13,, 1 (5 6 ) 11/20,, 2 (5 6 ) 11/27 (7 12/4 (9 ) 12/11 1 (10 ) 12/18 2 (10 ) 12/25 3 (11

More information

8 / 0 1 i++ i 1 i-- i C !!! C 2

8 / 0 1 i++ i 1 i-- i C !!! C 2 C 2006 5 2 printf() 1 [1] 5 8 C 5 ( ) 6 (auto) (static) 7 (=) 1 8 / 0 1 i++ i 1 i-- i 1 2 2.1 C 4 5 3 13!!! C 2 2.2 C ( ) 4 1 HTML はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");

More information

ソフトゼミC 第二回 C++の基礎

ソフトゼミC 第二回 C++の基礎 2013/08/06 エレクトロニクス研究部 C++ とは何か? ストリームライブラリを使った入出力 cin/coutについて CとC++ の構造体の違い classの基礎とメンバ関数 カプセル化 コンストラクタとは C++ とは何か? C++ はその名の通り C 言語の 拡張として 1983 年に作られた 開発当時は C with Classes と呼ばれ C 言語にクラスの概念を持たせた言語である

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 前回の出席確認演習 #include int main() { FILE *fp; int c, linecount, length, maxlength; fp=fopen("/usr/share/dict/words","r"); if (fp == NULL) return 1; linecount=0; length=0;

More information

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2005 7 22 22 (sakai.keiichi@kochi sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2005/index.html tech.ac.jp/k1sakai/lecture/alg/2005/index.html f(0) = 1, f(x) =

More information

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println(Hello World); (Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

3 3.1 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] B

3 3.1 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] B 3 3.1 algebraic datatype data 1 2... k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] Bob String y Charlie Foo Double Integer Alice 3.14 [1,2],

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1 I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming

More information

2017_08_ICN研究会_印刷用

2017_08_ICN研究会_印刷用 class Producer : noncopyable public: run() m_face.setinterestfilter("/example/testapp", bind(&producer::oninterest, this, _1, _2), RegisterPrefixSuccessCallback(), bind(&producer::onregisterfailed, this,

More information

SystemC言語概論

SystemC言語概論 SystemC CPU S/W 2004/01/29 4 SystemC 1 SystemC 2.0.1 CPU S/W 3 ISS SystemC Co-Simulation 2004/01/29 4 SystemC 2 ISS SystemC Co-Simulation GenericCPU_Base ( ) GenericCPU_ISS GenericCPU_Prog GenericCPU_CoSim

More information

yacc.dvi

yacc.dvi 2017 c 8 Yacc Mini-C C/C++, yacc, Mini-C, run,, Mini-C 81 Yacc Yacc, 1, 2 ( ), while ::= "while" "(" ")" while yacc 1: st while : lex KW WHILE lex LPAREN expression lex RPAREN statement 2: 3: $$ = new

More information

SystemC 2.0を用いた簡易CPUバスモデルの設計

SystemC 2.0を用いた簡易CPUバスモデルの設計 SystemC 2.0 CPU CPU CTD&SW CT-PF 2002/1/23 1 CPU BCA UTF GenericCPU IO (sc_main) 2002/1/23 2 CPU CPU CQ 1997 11 Page 207 4 Perl Verilog-HDL CPU / Verilog-HDL SystemC 2.0 (asm) ROM (test.hex) 2002/1/23

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

untitled

untitled Fortran90 ( ) 17 12 29 1 Fortran90 Fortran90 FORTRAN77 Fortran90 1 Fortran90 module 1.1 Windows Windows UNIX Cygwin (http://www.cygwin.com) C\: Install Cygwin f77 emacs latex ps2eps dvips Fortran90 Intel

More information

text_08.dvi

text_08.dvi C 8 12 6 6 8 Java (3) 1 8.1 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 8.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO Handy Graphic for Handy Graphic Version 0.5 2008-06-09 1 Handy Graphic Handy Graphic C Handy Graphic Handy Graphic Mac OS X Handy Graphic HgDisplayer Handy Graphic HgDisplayer 2 Handy Graphic 1 Handy Graphic

More information

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1 Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of

More information

DVIOUT

DVIOUT 2009 年度情報科学 & 情報科学演習レポート 7 学生用 学籍番号 : 氏名 : 下記の注意事項を守り 次ページ以降の問いに答え レポートを完成させなさい 提出期限 : 2009 年 6 月 16 日 ( 火 ) 13:00 まで提出場所 : 理学部棟正面玄関内に設置のレポートボックス 注意事項 : (1) このページを印刷し 必要事項を記入の上 ( 学籍番号欄と氏名欄は 2 箇所あるので忘れずに記入すること

More information

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

RHEA key

RHEA key 2 P (k, )= k e k! 3 4 Probability 0.4 0.35 0.3 0.25 Poisson ( λ = 1) Poisson (λ = 3) Poisson ( λ = 10) Poisson (λ = 20) Poisson ( λ = 30) Gaussian (µ = 1, s = 1) Gaussian ( µ = 3, s = 3) Gaussian (µ =

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

num9.dvi

num9.dvi kanenko@mbk.nifty.com alexei.kanenko@docomo.ne.jp http://www.kanenko.com/ FORTRAN ( mandelbrot.f) FORTRAN COMPLEX C,Z,W, W=Z**2+C, w = z 2 +c. OK. W=X*Z+2-1/Z Z=CMPLX(X,Y)! x, y z = x+iy X=REAL(Z)! z x

More information

ALG ppt

ALG ppt 2012 6 21 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 l l O(1) l l l 2 (123 ) l l l l () l H(k) = k mod n (k:, n: ) l l 3 4 public class MyHashtable

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

コンパイラ演習 第 7 回

コンパイラ演習 第 7 回 コンパイラ演習 第 7 回 (2010/11/18) 秋山茂樹池尻拓朗前田俊行鈴木友博渡邊裕貴潮田資秀小酒井隆広山下諒蔵佐藤春旗大山恵弘佐藤秀明住井英二郎 今日の内容 Type Polymorphism ( 型多相性 ) の実現について Polymorphism 大きく分けて 3 種類ある Parametric polymorphism Subtyping polymorphism Ad-hoc polymorphism

More information

untitled

untitled 2011 6 20 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2011/index.html tech.ac.jp/k1sakai/lecture/alg/2011/index.html html 1 O(1) O(1) 2 (123) () H(k) = k mod n

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

演習課題No12

演習課題No12 演習課題 No.12 ( 課題は 3 題ある ) 課題 12-1 時間内提出 従来の C 言語には複素数を直接扱うデータ型はないので (*), 構造体で複素数 ( 英語で complex) を表すことにする. 複素数を表す構造体を以下のように定義する. struct complex float r; // 実部 ( 英語で real) float i; // 虚部 ( 英語で imaginary)

More information

Informatics 2014

Informatics 2014 C 計算機の歴史 手回し計算機 新旧のソロバン バベッジの階差機関 スパコン ENIAC (1946) パソコン 大型汎用計算機 電卓 現在のコンピュータ Input Output Device Central Processing Unit I/O CPU Memory OS (Operating System) OS Windows 78, Vista, XP Windows Mac OS X

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 (Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 17 Fortran Formular Tranlator Lapack Fortran FORTRAN, FORTRAN66, FORTRAN77, FORTRAN90, FORTRAN95 17.1 A Z ( ) 0 9, _, =, +, -, *,

More information

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo 6 6 7 9 10 11 if 11 for 11 range 12 break continue 13 pass 13 13 14 15 15 23 23 24 24 24 25 import 26 27-1- Boo Boo Python CLI.NET

More information

1_cover

1_cover BetweenAS3 Updater Spark Project #APMT 2009.9.11 TAKANAWA Tomoaki ( http://nutsu.com ) http://www.libspark.org/svn/as3/betweenas3/tags/alpha-r3022/ public static function tween(...):iobjecttween { var

More information

H:\Projects2013\MatrixLibrary\MatrixLibrary\MatrixLibrary.cs /* ************************ * * * 行列関係のライブラリ * * * ************************ * * 行列の要素 A.V

H:\Projects2013\MatrixLibrary\MatrixLibrary\MatrixLibrary.cs /* ************************ * * * 行列関係のライブラリ * * * ************************ * * 行列の要素 A.V / 行列関係のライブラリ 行列の要素 A.Value[m, n] n 次単位行列 (static) Matrix.Identity(n) m n 型零行列 (static) Matrix.Zero(m, n) 行列式 (static) Matrix.Determinant(A) 逆行列 A.Inverse() m 行 n 列目を除いた小行列 A.SubMatrix(m, n) ただし 行 列の開始は

More information

バイオプログラミング第 1 榊原康文 佐藤健吾 慶應義塾大学理工学部生命情報学科

バイオプログラミング第 1 榊原康文 佐藤健吾 慶應義塾大学理工学部生命情報学科 バイオプログラミング第 1 榊原康文 佐藤健吾 慶應義塾大学理工学部生命情報学科 ポインタ変数の扱い方 1 ポインタ変数の宣言 int *p; double *q; 2 ポインタ変数へのアドレスの代入 int *p; と宣言した時,p がポインタ変数 int x; と普通に宣言した変数に対して, p = &x; は x のアドレスのポインタ変数 p への代入 ポインタ変数の扱い方 3 間接参照 (

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information