(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;

Size: px
Start display at page:

Download "(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;"

Transcription

1 (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; ++i) x.push_back(i); vector STL <> x.push_back(i) STL 2.1 C++( ) Vec3 float class Vec3 private: float x, y, z;... ; 1

2 double long double template<class Type> class Vec3 private: Type x, y, z;... ; Vec3<double> v; x,y,z double 3 vector STL vector vector vector<double> b; vector<triangle> c; 3 vector List.1 2

3 List.1 #include <iostream> #include <vector> using namespace std; int main(void) // vector<int> b(5, 1); // vector<int> c(b); // int i, n; cout << "n : " << endl; cin >> n; for(i = 0; i < n; ++i) a.push back(i); for(i = 0; i < n; ++i) cout << "a[" << i << "] = " << a[i] << endl; vector List.1 push_back vector<int> a push_back vector push_back insert new delete vector List.1 n n : 5 a[0] = 0 a[1] = 1 a[2] = 2 a[3] = 3 a[4] = vector int* pa; 3

4 int i; for(i = 0; i < 50000; ++i) a.push_back(i); pa = &a[3]; for(i = 50000; i < ; ++i) a.push_back(i); cout << *pa << endl; a[3] pa vector vector reserve resize List.2 List.2 capacity size size int t[10]; 10 capacity List.2 push_back 0 a size : 1 capacity : 1 1 a size : 2 capacity : 2 2 a size : 3 capacity : 3 3 a size : 4 capacity : 4 4 a size : 5 capacity : 6 5 a size : 6 capacity : 6 6 a size : 7 capacity : 9 7 a size : 8 capacity : 9 8 a size : 9 capacity : 9 9 a size : 10 capacity : 13 reserve 0 a size : 1 capacity : 10 1 a size : 2 capacity : 10 2 a size : 3 capacity : 10 3 a size : 4 capacity : 10 4 a size : 5 capacity : 10 5 a size : 6 capacity : 10 6 a size : 7 capacity : 10 7 a size : 8 capacity : 10 8 a size : 9 capacity : 10 9 a size : 10 capacity : 10 resize 0 a size : 10 capacity : 10 1 a size : 10 capacity : 10 2 a size : 10 capacity : 10 3 a size : 10 capacity : 10 4 a size : 10 capacity : 10 4

5 5 a size : 10 capacity : 10 6 a size : 10 capacity : 10 7 a size : 10 capacity : 10 8 a size : 10 capacity : 10 9 a size : 10 capacity : 10 push_back size capacity push_back reserve reserve (reserve: ) 10 reserve(10) reserve push_back resize resize resize vector<int> v; v.resize(10, 0);(int 10 0 ) 5

6 List.2 #include <iostream> #include <vector> using namespace std; int main(void) int i, n; cout << "n : "; cin >> n; cout << "push back" << endl; for(i = 0; i < n; ++i) a.push back(i); cout << i << " a size : " << (int)a.size(); cout << " capacity : " << (int)a.capacity() << endl; a.clear(); cout << "reserve" << endl; a.reserve(n); for(i = 0; i < n; ++i) a.push back(i); cout << i << " a size : " << (int)a.size(); cout << " capacity : " << (int)a.capacity() << endl; a.clear(); cout << "resize" << endl; a.resize(n); for(i = 0; i < n; ++i) a[i] = i; cout << i << " a size : " << (int)a.size(); cout << " capacity : " << (int)a.capacity() << endl; return 0; 6

7 [] 2 at() at( ) [] [] at() at() out_of_range List.3 try-catch try catch List.3 error : 10 List.3 #include <iostream> #include <vector> using namespace std; int main(void) int i, n; cout << "n : "; cin >> n; a.resize(n); try for(i = 0; i < n+10; ++i) a.at(i) = i; catch(out of range err) cout << "error : " << i; cout << " " << endl; return 0; 7

8 4 STL 3 ( ) 4.1 vector (container) vector deque( ) list( ) STL vector : deque : list : queue, stack : map : set : 4.2 (iterator, ) * vector list iterator : input_iterator : output_iterator : forward_iterator : bidirectional_iterator : random_access_iterator : const_iterator : const 8

9 iterator iterator const_iterator List.4 List.4 #include <iostream> #include <vector> using namespace std; int main(void) vector<int>::iterator pa; int i, n; cout << "n : "; cin >> n; a.resize(n); // // pa = a.begin(); i = 0; while(pa!= a.end()) pa = i; pa++; i++; // for(pa = a.begin(); pa!= a.end(); ++pa) cout << pa << " "; return 0; begin() end() 1 while(pa!= a.end()) ( end()-1 ) n : (algorithm) sort List.5 9

10 n :

11 List.5 #include <iostream> #include <vector> #include <algorithm> #include <stdlib.h> using namespace std; // inline int nrand(int n) return (int)(rand()/(1.0f+rand MAX) n); int main(void) vector<int>::iterator pa; int i, n; cout << "n : "; cin >> n; // // // a.resize(n); for(i = 0; i < n; ++i) a[i] = nrand(100); for(pa = a.begin(); pa!= a.end(); ++pa) cout << pa << " "; cout << endl; // sort(a.begin(), a.end()); for(pa = a.begin(); pa!= a.end(); ++pa) cout << pa << " "; cout << endl; return 0; 11

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

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

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言語 実践編

新版明解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

cpp1.dvi

cpp1.dvi 2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout

More information

Qt (Generic Containers) Java STL <QtAlgorithms> STL (Generic Algorithms) QList<T>, QLinkedList<T>, QVector<T>, QStack<T>, QQueue<T> QMap<Key,

Qt (Generic Containers) Java STL <QtAlgorithms> STL (Generic Algorithms) QList<T>, QLinkedList<T>, QVector<T>, QStack<T>, QQueue<T> QMap<Key, 1 5 5.1 Qt (Generic Containers) Java STL STL (Generic Algorithms) QList, QLinkedList, QVector, QStack, QQueue QMap, QMultiMap. QHash, QMultiHash

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

新・明解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

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

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

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

解きながら学ぶ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

4-3- 基 C++ に関する知識 オープンソースシステムのソースを解読する上で C++ の知識は必須であるといえる 本カリキュラムでは まずオブジェクト指向に関する Ⅰ. 概要理解を深め クラスの扱い方について学習し STL を使用してアルゴリズムとデータ構造を実装する方法を学習する Ⅱ. 対象専

4-3- 基 C++ に関する知識 オープンソースシステムのソースを解読する上で C++ の知識は必須であるといえる 本カリキュラムでは まずオブジェクト指向に関する Ⅰ. 概要理解を深め クラスの扱い方について学習し STL を使用してアルゴリズムとデータ構造を実装する方法を学習する Ⅱ. 対象専 4-3- 基 C++ に関する知識 1 4-3- 基 C++ に関する知識 オープンソースシステムのソースを解読する上で C++ の知識は必須であるといえる 本カリキュラムでは まずオブジェクト指向に関する Ⅰ. 概要理解を深め クラスの扱い方について学習し STL を使用してアルゴリズムとデータ構造を実装する方法を学習する Ⅱ. 対象専門分野職種共通 Ⅲ. 受講対象者 本カリキュラムの 4-2-

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

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

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

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

More information

基礎プログラミング2015

基礎プログラミング2015 応用プログラミング 第 11 回 関数の名前 2017 年 11 月 29 日 ( 水 ) 第 12 章 関数の名前 今日の内容 * これまでの関数 必ず main 関数 ( 呼び出し元 ) の前に関数定義をする 宣言した仮引数の数と実引数として渡す値の数は同じ 仮引数の型に合わせた値渡し (1) 関数宣言 : 関数の戻り値の型, 名前, 引数の型のみ先行指定 (2) 多重定義 : 引数が異なる同じ名前の関数の作成

More information

C++0x

C++0x C++0x 言語の未来を語る 高橋晶 ( アキラ ) Blog: Faith and Brave C++ で遊ぼう Agenda What s C++0x Angle Bracket Initializer List auto decltype Delegating Constructor Extending sizeof Raw String Literal Defaulted and Deleted

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

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

新版 明解C++入門編

新版 明解C++入門編 第 1 章画面 出力 入力 C++ C++ C++ C++ C++ C++ C++ C++ #include using C++ C++ C++ main C++ C++ C++ int double char C++ C++ C++ string C++ C++ C++ 21 1-1 C++ 歴史 C++ C++ 歴史 CC with classes Fig.1-1 C C++ Simula 67

More information

スライド 1

スライド 1 今 此処にある C++ ~ テンプレートと STL~ テンプレートの解説 コンテナ イテレータ アルゴリズム アジェンダ テンプレートとは 型を外部から変更可能にした構文 通常の構文 int max(int a, int b){ return a > b? a : b; テンプレートを使った構文 template T max(t a, T b){ return a > b?

More information

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

解きながら学ぶC++入門編 第 1 章 画面 出力 入力 2 問題 1-1 C++ List 1-1p.4 C++ // cout

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

1 CUI CUI CUI 1.1 cout cin 1.1.1 redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c

1 CUI CUI CUI 1.1 cout cin 1.1.1 redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c C/C++ 007 6 11 1 CUI 1.1....................................... 1................................ 3 1.3 argc argv................................. 5.1.............................................. 5...............................................

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

解きながら学ぶ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

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

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

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

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

Green with White Lines

Green with White Lines 各種コンテナの実装と性能 Qt #4 勉強会福岡 @ kikairoya About Twitter: @kikairoya 宮崎県都城市から来ました 本職 : 精密機械設計 組込機器開発 C++ とか出来ます Qt わかりません Abstruct STL コンテナと Qt コンテナの比較 データ構造 パフォーマンス 安全性 インタフェース おまけで Boost コンテナも STL Containers

More information

基礎プログラミング2015

基礎プログラミング2015 応用プログラミング 第 10 回 構造体 2017 年 11 月 22 日 ( 水 ) 第 11 章 構造体 構造体 * 国民の個人情報を管理したい例 : マイナンバー (id), 名前 (na), 年齢 (ag) * 管理する方法は? 配列を用いる方法 ただし, 年齢などでソートするとき面倒 id[0] id[1] id[2] id[3] id[4] na[0] na[1] na[2] na[3]

More information

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç.. lê~åäé= qçéiáåâ= NMÖENMKNKPF Volume2 Creation Date: Mar 04, 2005 Last Update: Aug 22, 2005 Version 1.0 ...3... 3 TopLink å...4 1... 4... 4 SampleClient.java... 5 Ò... 8... 9... 10 readallsample()... 11

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information

Slide 1

Slide 1 OpenFoam のための C/C++ 第 3 回 OpenFoam で勉強るテンプレート 田中昭雄 1 目的 この勉強会の資料があれば OpenFoam カスタマイズ時に C/C++ で迷わない 2 予定 第 1 回メモリ管理 第 2 回 CFDの例で勉強するクラス 第 3 回 OpenFOAMで勉強するテンプレート 第 4 回 OpenFOAMカスタマイズ 第 5 回未定 第 6 回未定 3 今回のテーマ

More information

PowerPoint プレゼンテーション - 物理学情報処理演習

PowerPoint プレゼンテーション  -  物理学情報処理演習 物理学情報処理演習 6. C 言語 3 演算 制御文 gnuplot 本日の推奨作業 directory lesson06 2016 年 5 月 24 日 VER 20160524_3 6.1 演算 ( 算術以外 ) 6.2 制御文 参考文献 やさしい C++ 第 4 版高橋麻奈 ( 著 ) ソフトバンククリエイティブ プログラミング言語 C++ 第 4 版ビャーネ ストラウストラップ, Bjarne

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

基礎プログラミング2015

基礎プログラミング2015 応用プログラミング 第 4 回 ファイル操作 2017 年 10 月 11 日 ( 水 ) 第 6 章 ファイル操作 標準入出力とファイル (P.50) これまでのプログラム 入力 : キーボード 出力 : ディスプレイ Input an integer 1024 1024 標準入出力とファイル (P.50) 今回のプログラム 入力 : ファイル ( の内容 ) 出力 : ファイル Input a

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

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

コンパイラ演習 第 7 回

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

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

オートマトンと言語理論 テキスト 成蹊大学理工学部情報科学科 山本真基 ii iii 1 1 1.1.................................. 1 1.2................................ 5 1.3............................. 5 2 7 2.1..................................

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

untitled

untitled Q 8 1 8.1 (C++) C++ cin cout 5 C++ 16 6 p.63 8.3 #include 7 showbase noshowbase showpoint noshowpoint 8.3 uppercase 16 nouppercase 16 setfill(int) setprecision(int) setw(int) setbase(int) dec

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

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; 19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(

More information

2 ColorSpace DepthSpace CameraSpace Kinect V2 Kinect V2 BOdyIndex 3. NtKinect Kinect V2 C++ NtKinect [4] NtKinect = Kinect SDK + + STL(C++) + OpenCV +

2 ColorSpace DepthSpace CameraSpace Kinect V2 Kinect V2 BOdyIndex 3. NtKinect Kinect V2 C++ NtKinect [4] NtKinect = Kinect SDK + + STL(C++) + OpenCV + NtKinect: C++ Class Library for Kinect V2 1,a) Kinect for Windows V2 C++ NtKinect NtKinect DLL Kinect V2 Kinect V2, C++, DLL, Unity NtKinect: C++ Class Library for Kinect V2 Nitta Yoshihisa 1,a) Abstract:

More information

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な 問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値なので 水量を 1m 3 ずつ増やして料金を加算していく簡単なアルゴリズムでも大丈夫です 具体的には 使用水量

More information

北米アジャイル界デビュー fkinoからは 何も聞いてませんでした これまでに書いたもの Web 2.0 ビギナーズバイブル エンジニアマインド vol.5 開発の現場 vol.011 Dave 達人 Thomasも云ってたよ http://jp.rubyist.net/rubykaigi2007/?c=plugin;plugin=attach_download;p=program0610;file_name=the_island_of_ruby_j.pdf

More information

1 1.1 (JCPRG) 30 Nuclear Reaction Data File (NRDF) PC GSYS2.4 JCPRG GSYS2.4 Java Windows, Linux, Max OS X, FreeBSD GUI PNG, GIF, JPEG X Y GSYS2

1 1.1 (JCPRG) 30 Nuclear Reaction Data File (NRDF) PC GSYS2.4 JCPRG GSYS2.4 Java Windows, Linux, Max OS X, FreeBSD GUI PNG, GIF, JPEG X Y GSYS2 (GSYS2.4) GSYS2.4 Manual SUZUKI Ryusuke Hokkaido University Hospital Abstract GSYS2.4 is an update version of GSYS version 2. Main features added in this version are Magnifying glass function, Automatically

More information

Blackfin(ADSP-BF533)活用ハンドブック

Blackfin(ADSP-BF533)活用ハンドブック () 103 Column 5-A C: Program Files Analog Devices VisualDSP 3.5 16-Bit C: Program Files Analog Devices VisualDSP 4.0 104 ( ) ( ) ( ) Column 5-B () () 105 ( ) ( ) 106 ( ).vdu () http://www.analog.com/processors/processors/blackfin/crosscore/toolsupgrades/

More information

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for embedded systems that use microcontrollers (MCUs)

More information

@okuraofvegetabl

@okuraofvegetabl @okuraofvegetabl 3 I 5 1?................................. 5 2........................... 6 3,.................................. 6 4................................. 11 II 15 1 Bellman-Ford( )....................

More information

資料

資料 PC PC C VMwareをインストールする Tips: VmwareFusion *.vmx vhv.enable = TRUE Tips: Windows Hyper-V -rwxr-xr-x 1 masakazu staff 8552 7 29 13:18 a.out* -rw------- 1 masakazu staff 8552 7 29

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

endo.PDF

endo.PDF MAP 18 19 20 21 3 1173 MAP 22 700800 106 3000 23 24 59 1984 358 358 399 25 12 8 1996 3 39 24 20 10 1998 9,000 1,400 5,200 250 12 26 4 1996 156 1.3 1990 27 28 29 8 606 290 250 30 11 24 8 1779 31 22 42 9

More information

P6dark P6dark µ-pic 2 µ-pic 2 3 µ-pic µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN ASD (16ns[C]) (16nsC

P6dark P6dark µ-pic 2 µ-pic 2 3 µ-pic µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN ASD (16ns[C]) (16nsC 1 2010 P6dark 2011 2 10 1 P6dark µ-pic 2 µ-pic 2 3 µ-pic 256 256 2 3 µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN 060830-2 ASD (16ns[C]) (16nsC ) PAN16-10A ASD ( ) 3.37V PAN16-30A ASD (+) +3.36V

More information

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

C C UNIX C ( ) 4 1 HTML 1

C C UNIX C ( ) 4 1 HTML 1 C 2007 4 18 C UNIX 1 2 1 1.1 C ( ) 4 1 HTML 1 はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga hoge.c コンパイルにより機械語に変換 コンパイルエラー./fuga 実行 実行時エラー 完成 1: work hooge.c fuga 1 4 4 1 1.

More information

PowerPoint プレゼンテーション - 物理学情報処理演習

PowerPoint プレゼンテーション  -  物理学情報処理演習 物理学情報処理演習 8. C 言語 5 文字列 ポインタ 2016 年 6 月 7 日 ver20160607_2 本日の推奨作業 directory lesson08 8.1 文字列 8.2 ポインタ 参考文献 やさしい C++ 第 4 版高橋麻奈 ( 著 ) ソフトバンククリエイティブ プログラミング言語 C++ 第 4 版ビャーネ ストラウストラップ, Bjarne Stroustrup, 柴田望洋

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

PowerPoint プレゼンテーション - 物理学情報処理演習

PowerPoint プレゼンテーション  -  物理学情報処理演習 本日の推奨作業 directory lesson07 物理学情報処理演習 7. C 言語 3 2015 年 5 月 29 日 ver2015529 7.1 プログラムの書き方 7.2 配列 参考文献 やさしい C++ 第 4 版高橋麻奈 ( 著 ) ソフトバンククリエイティブ プログラミング言語 C++ 第 4 版ビャーネ ストラウストラップ, Bjarne Stroustrup, 柴田望洋 Numerical

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

/ 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

やさしい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

1 Java Java GUI , 2 2 jlabel1 jlabel2 jlabel3 jtextfield1 jtextfield2 jtextfield3 jbutton1 jtextfield1 jtextfield2 jtextfield3

1 Java Java GUI , 2 2 jlabel1 jlabel2 jlabel3 jtextfield1 jtextfield2 jtextfield3 jbutton1 jtextfield1 jtextfield2 jtextfield3 1 2 2 1 2 2.1.................................................... 2 2.2.................................................... 2 2.3........................................ 2 2.4....................................................

More information

!!! 10 1 110 88 7 9 91 79 81 82 87 6 5 90 83 75 77 12 80 8 11 89 84 76 78 85 86 4 2 32 64 10 44 13 17 94 34 33 107 96 14 105 16 97 99 100 106 103 98 63 at 29, 66 at 58 12 16 17 25 56

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

修士論文

修士論文 27 Mobile Ad Hoc Networks An Ant-based Routing Algorithm with Multi-phase Pheromone and Power-saving in Mobile Ad Hoc Networks 14T0013 Shohei Miyashita E-mail: shohei.miyashita.4j@stu.hosei.ac.jp : Abstract

More information

joho12.ppt

joho12.ppt n φ 1 (x),φ 2 (x),,φ n (x) (x i, f i ) Q n c 1,,c n (,f k ) q n = c i φ i (x) x Q n i=1 c 1 = 0 c 1 n ( c 1 ) = q n f k 2 Q n ( c 1 ) = q 2 2 n ( ) 2 f k q n ( ) + f k Q n c 1 = c 1 q n 2 q n( ) q n q

More information

C# ++ MASA C# ( ) XNA 1.1 C# ( ) VisualStuio XNA 4.0 VisualStuio XNA 3.1 * * *3 2.1 VisualStuio Windows ( TextGam

C# ++ MASA C# ( ) XNA 1.1 C# ( ) VisualStuio XNA 4.0 VisualStuio XNA 3.1 * * *3 2.1 VisualStuio Windows ( TextGam C# ++ MASA 2011 8 1 C# ( ) XNA 1.1 C# ( ) VisualStuio 2010 + XNA 4.0 VisualStuio 2008 + XNA 3.1 *1 1.2 1 *2 1.3 2 *3 2.1 VisualStuio Windows ( TextGame2 ) OK *1 XNA 3.1 4.0 *2 *3 1 TextGame2 ( Ship ) 32*32

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

PowerPoint プレゼンテーション - 物理学情報処理演習

PowerPoint プレゼンテーション  -  物理学情報処理演習 物理学情報処理演習 2017 年 5 月 2 日 ver20170411 4. C++ 言語 1 開発 編集 4.1 プログラム開発 4.2 C 言語の構造 4.3 入出力 身内賢太朗レポート提出 :fsci-phys-jouhou@edu.kobe-u.ac.jp 4.1 プログラム開発 プログラム開発の流れ ( 先週の作業を思い出しながら ) 4.1.1 プログラム編集 ソースコードファイルを作る

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

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

Microsoft PowerPoint - C++_第1回.pptx

Microsoft PowerPoint - C++_第1回.pptx OpenFoam のための C/C++ 第 1 回メモリ管理 田中昭雄 1 目的 この勉強会の資料があれば OpenFoam カスタマイズ時に C/C++ で迷わない 2 予定 第 1 回メモリ管理 第 2 回 OpenFOAM で勉強するクラス 第 3 回 OpenFOAM で勉強するテンプレート 第 4 回 OpenFOAM カスタマイズ 第 5 回未定 第 6 回未定 3 今回のテーマ C++

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

とても使いやすい Boost の serialization

とても使いやすい Boost の serialization とても使いやすい Boost の serialization Zegrahm シリアライズ ( 直列化 ) シリアライズ ( 直列化 ) とは何か? オブジェクトデータをバイト列や XML フォーマットに変換すること もう少しわかりやすく表現すると オブジェクトの状態を表す変数 ( フィールド ) とオブジェクトの種類を表す何らかの識別子をファイル化出来るようなバイト列 XML フォーマット形式で書き出す事を言う

More information

@okuraofvegetabl

@okuraofvegetabl @okuraofvegetabl 3 I 5 II 7 1.................................... 7 2............................... 10 3................................... 10 4............................ 21 III 29 1 Propagating tree

More information

スライド 1

スライド 1 参考論文 :Nong, Zhang, and Chan. Two Efficient Algorithms for Linear Suffix Array Construction. (009) Appendix のプログラムの解説 プログラムを Microsoft Visual C++ の環境で動かす際の注意点 先頭で使いそうなライブラリを指定 #include #include

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

Programming-C-9.key

Programming-C-9.key プログラミングC 第9回 例外 スレッド 白石路雄 2 finally try{ ( 例外が発生するかもしれない処理 ) catch(exception のクラス名 e){ ( 例外が発生した時の処理 ) finally{ ( 例外の発生の有無に関わらず 必ず行う処理 ) 3 Integer.parseInt() NumberFormatException

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information