design_pattern.key
|
|
- あいと こうだ
- 6 years ago
- Views:
Transcription
1
2
3
4
5
6
7
8
9
10 #include <iostream> 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) for (int i = 0; i < size; ++i) std::cout << ary[i] << std::endl; int main(void) const int LENGTH = 10; int array[length]; init(array, LENGTH); dispary(array, LENGTH); mul10(array, LENGTH); dispary(array, LENGTH); #include <iostream> class ArrayProcessor public: void doprocess(int* ary, int size) for (int i = 0; i < size; ++i) proc(ary[i], i); protected: // この関数をオーバーライドすることで派生クラスによって処理を切り替えることができる virtual void proc(int& element, int index) = 0; ; class ArrayInitializer : public ArrayProcessor protected: void proc(int& element, int index) element = index; ; class ArrayMultiplier : public ArrayProcessor protected: void proc(int& element, int index) element *= 10; ; class ArrayDisplay : public ArrayProcessor protected: void proc(int& element, int index) std::cout << element << std::endl; ; // 派生クラスの型に合わせてdoProcessの処理が変化 void proc(arrayprocessor& proc, int* ary, int size) proc.doprocess(ary, size); // main int main(void) const int LENGTH = 10; int array[length]; ArrayInitializer init; ArrayDisplay ArrayMultiplier ArrayDetailDisplay dis; multi; del; proc(init, array, LENGTH); proc(dis, array, LENGTH); proc(multi, array, LENGTH); proc(del, array, LENGTH); return 0;
11
12
13
14
15
16
17
18 #include <iostream> class Prop public: void propcalc(int* ary, int size) for (int i = 0 ; i<size ; i++) calc(ary[i], i); protected: // この関数をオーバーライドすることで派生クラスによって処理を切り替えることができる virtual void calc(int& element, int index) = 0; ; // ここから派生クラスで実装して使用するときは基底クラスから呼び出す class PropInitializer : public Prop protected: void calc(int& element, int index) element = index; ; class PointSource : public Prop protected: void calc(int& element, int index) element *= 10; ; class WallSource : public Prop protected: void calc(int& element, int index) element *= 100; ; class PropGet : public Prop protected: void calc(int& element, int index) std::cout << element << std::endl; ; // 派生クラスの型に合わせて propcalc の処理が変化 void propagetor(prop& obj_prop, int* ary, int size) obj_prop.propcalc(ary, size); // main int main(void) const int LENGTH = 10; int array[length]; PropInitializer init; PropGet get; WallSource wall; PointSource point; propagetor(init, array, LENGTH); propagetor(wall, array, LENGTH); propagetor(get, array, LENGTH); propagetor(init, array, LENGTH); propagetor(point, array, LENGTH); propagetor(get, array, LENGTH); return 0;
19 #include <iostream> class Prop public: void propcalc(int* ary, int size) for (int i = 0 ; i<size ; i++) calc_src(ary[i], i); protected: // この関数をオーバーライドすることで派生クラスによって処理を切り替えることができる virtual void calc_src(int& element, int index) = 0; ; // ここから派生クラスで実装して使用するときは基底クラスから呼び出す class PropInitializer : public Prop ; class PointSource : public Prop protected: void calc_src(int& element, int index) std::cout<<"calc point src" << std::endl; element *= 10; ; class WallSource : public Prop protected: void calc_src(int& element, int index) std::cout<<"calc wall src" << std::endl; element *= 100; ; // context class によってインターフェイス (Prop) にアクセス class Context public: // コンストラクタ \ \ Context(Prop* obj_prop, int size) obj_prop_ = obj_prop; size_ = size; array_ = new int[size_](); // デストラクタ ~Context() delete [] array_; free (obj_prop_;) void init() for (int i =0 ; i< size_ ;i ++) array_[i] = i; void PropGet() for(int i =0; i<size_ ;i ++) std::cout << array_[i] << std::endl; void calc() obj_prop_->propcalc(array_,size_); private: Prop* obj_prop_; int* array_; int size_; // 派生クラスの型に合わせて propcalc の処理が変化 ; // main int main(void) const int LENGTH = 10; Context* obj1 = new Context(new WallSource(),LENGTH); Context* obj2 = new Context(new PointSource(),LENGTH); obj1->init(); obj1->calc(); obj2->init(); obj2->calc(); obj1->propget(); obj2->propget(); return 0;
20
21
22
23
24
25
26
27
28
29 #include <iostream> #include <string> /* Implemented interface. */ class AbstractInterface public: virtual void somefunctionality() = 0; ; /* Interface for internal implementation that Bridge uses. */ class ImplementationInterface public: virtual void anotherfunctionality() = 0; ; /* The Bridge */ class Bridge : public AbstractInterface protected: ImplementationInterface* implementation; public: Bridge(ImplementationInterface* backend) implementation = backend; ; class UseCase1 : public Bridge public: UseCase1(ImplementationInterface* backend) : Bridge(backend) void somefunctionality() std::cout << "UseCase1 on "; implementation->anotherfunctionality(); ; class UseCase2 : public Bridge public: UseCase2(ImplementationInterface* backend) : Bridge(backend) void somefunctionality() std::cout << "UseCase2 on "; implementation->anotherfunctionality(); ; /* Different special cases of the interface. */ /* Different background implementations. */ class Windows : public ImplementationInterface public: void anotherfunctionality() std::cout << "Windows :-" << std::endl; ; class Linux : public ImplementationInterface public: void anotherfunctionality() std::cout << "Linux :-)" << std::endl; ; int main() AbstractInterface *usecase = 0; ImplementationInterface *oswindows = new Windows; ImplementationInterface *oslinux = new Linux; /* First case */ usecase = new UseCase1(osWindows); usecase->somefunctionality(); usecase = new UseCase1(osLinux); usecase->somefunctionality(); /* Second case */ usecase = new UseCase2(osWindows); usecase->somefunctionality(); usecase = new UseCase2(osLinux); usecase->somefunctionality(); return 0; UseCase1 on Windows :- UseCase1 on Linux :-) UseCase2 on Windows :- UseCase2 on Linux :-)
30 #include <iostream> #include <string> /* Implemented interface. */ class AbstractInterface public: virtual void somefunctionality() = 0; ; /* Interface for internal implementation that Bridge uses. */ class ImplementationInterface public: virtual void anotherfunctionality() = 0; ; /* The Bridge */ class Bridge : public AbstractInterface protected: ImplementationInterface* implementation; public: Bridge(ImplementationInterface* backend) implementation = backend; ; /* Different special cases of the interface. */ class UseCase1 : public Bridge public: UseCase1(ImplementationInterface* backend) : Bridge(backend) void somefunctionality() std::cout << "UseCase1 on "; implementation->anotherfunctionality(); ; class UseCase2 : public Bridge /* Different background implementations. */ class Windows : public ImplementationInterface public: void anotherfunctionality() std::cout << "Windows :-" << std::endl; ; class Linux : public ImplementationInterface public: void anotherfunctionality() std::cout << "Linux :-)" << std::endl; ; int main() AbstractInterface *usecase = 0; ImplementationInterface *oswindows = new Windows; ImplementationInterface *oslinux = new Linux; /* First case */ usecase = new UseCase1(osWindows); usecase->somefunctionality(); usecase = new UseCase1(osLinux); usecase->somefunctionality(); /* Second case */ usecase = new UseCase2(osWindows); usecase->somefunctionality(); usecase = new UseCase2(osLinux); return 0; usecase->somefunctionality(); public: UseCase2(ImplementationInterface* backend) : Bridge(backend) void somefunctionality() std::cout << "UseCase2 on "; implementation->anotherfunctionality(); ;
31
32
33
34
35
36 #include <iostream> class Singleton public: // 唯一のアクセス経路 static Singleton* GetInstance() static Singleton instance; // 唯一のインスタンス return &instance; // あとは このクラス自身が必要なメンバを定義する private: // 生成やコピーを禁止する Singleton() Singleton(const Singleton& rhs); Singleton& operator=(const Singleton& rhs); ; int main() Singleton* obj1 = obj1->getinstance(); Singleton* obj2 = obj2->getinstance(); if(obj1==obj2) std::cout << "same instance"<<std::endl; return 0;
37
38
39
40
41 #include <cstring> #include <iostream> using namespace std; //Adaptee class Banner public : Banner(string str) this->string_ = str; void ShowWithParen() cout << string_.c_str() << endl; void ShowWithAster() cout << "*" << string_.c_str() << "*" << endl; private : string string_; ; //Target(interface) class Print public : virtual ~Print(); virtual void PrintWeak() = 0; virtual void PrintStrong() = 0; ; //Adapter class PrintBanner : public Print public : ~PrintBanner() delete banner_; PrintBanner(string str) banner_ = new Banner(str); void PrintWeak() banner_->showwithparen(); void PrintStrong() banner_->showwithaster(); private : Banner * banner_; ; int main() Print *p = new PrintBanner("Hello"); p->printweak(); p->printstrong(); delete p; getchar(); return 0;
42
43
44
Microsoft PowerPoint ppt
独習 Java ( 第 3 版 ) 6.7 変数の修飾子 6.8 コンストラクタの修飾子 6.9 メソッドの修飾子 6.10 Object クラスと Class クラス 6.7 変数の修飾子 (1/3) 変数宣言の直前に指定できる修飾子 全部で 7 種類ある キーワード final private protected public static transient volatile 意味定数として使える変数同じクラスのコードからしかアクセスできない変数サブクラスまたは同じパッケージ内のコードからしかアクセスできない変数他のクラスからアクセスできる変数インスタンス変数ではない変数クラスの永続的な状態の一部ではない変数不意に値が変更されることがある変数
More informationuntitled
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 informationMicrosoft Word - C言語研修 C++編 3.doc
2006/05/10 オブジェクト指向... 3 1 クラスの継承... 3 2 継承の書式... 3 3 protected... 5 4 メンバ関数のオーバーライド... 6 5 クラスの型キャスト... 7 6 仮想関数... 8 2 オブジェクト指向 1 クラスの継承 クラスには 継承 という機能があります 継承とは 既にあるクラスを元に 新しいクラスを作る 機能です 継承元のクラスを 親クラス
More informationcpp4.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 information3.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(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ソフトゼミC 第二回 C++の基礎
2013/08/06 エレクトロニクス研究部 C++ とは何か? ストリームライブラリを使った入出力 cin/coutについて CとC++ の構造体の違い classの基礎とメンバ関数 カプセル化 コンストラクタとは C++ とは何か? C++ はその名の通り C 言語の 拡張として 1983 年に作られた 開発当時は C with Classes と呼ばれ C 言語にクラスの概念を持たせた言語である
More informationProg2_12th
2018 年 12 月 13 日 ( 木 ) 実施クラスの継承オブジェクト指向プログラミングの基本的な属性として, 親クラスのメンバを再利用, 拡張, または変更する子クラスを定義することが出来る メンバの再利用を継承と呼び, 継承元となるクラスを基底クラスと呼ぶ また, 基底クラスのメンバを継承するクラスを, 派生クラスと呼ぶ なお, メンバの中でコンストラクタは継承されない C# 言語では,Java
More informationCondition 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 informationMicrosoft PowerPoint pptx
PFCore(RT ミドルウェア ) トレーニング中級編 10:00-11:00 第 1 部 :RT コンポーネントプログラミングの概要 担当 : 安藤慶昭 ( 産業技術総合研究所 ) 概要 :RT コンポーネントの作成方法, 設計時の注意点などの概要について解説します 第 2 部 :RT ミドルウェア (PFcore) 開発支援ツールと RT コンポーネントの作成方法 11:00-12:00 12:00-13:00
More information1 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 informationcpp1.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 informationdouble 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解きながら学ぶ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 information11 ソフトウェア工学 Software Engineering デザインパターン DESIGN PATTERNS デザインパターンとは? デザインパターン 過去のソフトウェア設計者が生み出したオブジェクト指向設計に関して, ノウハウを蓄積し 名前をつけ 再利用しやすいようにカタログ化したもの 各デ
11 ソフトウェア工学 Software Engineering デザインパターン DESIGN PATTERNS デザインパターンとは? デザインパターン 過去のソフトウェア設計者が生み出したオブジェクト指向設計に関して, ノウハウを蓄積し 名前をつけ 再利用しやすいようにカタログ化したもの 各デザインパターンの主な内容 そのデザインパターンの目的と効果 どのような役割の部品 ( クラス, インタフェース
More informationFactory Method 2003/07/18 特徴スーパークラスで複数のインスタンスを管理するためのパターン ( スーパークラス ( の型として ) で扱いたいインスタンスが存在するが, スーパークラスではそのインスタンスを生成せずにインターフェースだけを規定し, 各サブクラスでそのインスタン
Factory Method 特徴スーパークラスで複数のインスタンスを管理するためのパターン ( スーパークラス ( の型として ) で扱いたいインスタンスが存在するが, スーパークラスではそのインスタンスを生成せずにインターフェースだけを規定し, 各サブクラスでそのインスタンスを生成させる. そして, そのリストをインスタンスを作成したクラス ( インスタンス ) で保持する.) Template
More informationALG ppt
2012 7 5 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html (198 ) f(p) p 2 1 2 f 2 53 12 41 69 11 2 84 28 31 63 97 58 76 19 91 88 53 69 69 11 84 84 63
More information1-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 informationohp03.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 informationC のコード例 (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 informationSystemC言語概論
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 informationMicrosoft PowerPoint - ep_cpp04.ppt
C++ による 画像処理プログラミング - 第 4 回 - 情報科学研究科視覚情報メディア講座 佐藤智和 tomoka-s@is.naist.jp version 1.0 今回説明すること 前回の課題の解答 バグを防ぐためのC++ の記述方法 const メモリリークのチェック (new, delete, malloc, free) 課題 1 の解答例 unsigned char getrgbintensity::crgbimage(
More informationr03.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 informationC 言語経験者のための 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 informationMicrosoft PowerPoint - chap10_OOP.ppt
プログラミング講義 Chapter 10: オブジェクト指向プログラミング (Object-Oriented Programming=OOP) の入り口の入り口の入り口 秋山英三 F1027 1 例 : 部屋のデータを扱う // Test.java の内容 public class Test { public static void main(string[] args) { double length1,
More informationとても使いやすい Boost の serialization
とても使いやすい Boost の serialization Zegrahm シリアライズ ( 直列化 ) シリアライズ ( 直列化 ) とは何か? オブジェクトデータをバイト列や XML フォーマットに変換すること もう少しわかりやすく表現すると オブジェクトの状態を表す変数 ( フィールド ) とオブジェクトの種類を表す何らかの識別子をファイル化出来るようなバイト列 XML フォーマット形式で書き出す事を言う
More informationVB.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 informationfile:///D|/C言語の擬似クラス.txt
愛知障害者職業能力開発校 システム設計科 修了研究発表会報告書 題名 : C 言語の擬似クラス あらまし : C 言語でクラスを作れるという噂の真偽を確かめるために思考錯誤した まえがき : VC++ や Java その他オブジェクト指向の言語にはクラスが存在して クラスはオブジェクトの設計図である 手法 : C++ のクラスを解析して C++ のクラスを作成して C 言語に翻訳する class struct
More informationMicrosoft 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 informationjoho07-1.ppt
0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*
More informationExam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac
Actual4Test http://www.actual4test.com Actual4test - actual test exam dumps-pass for IT exams Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN
More informationいった対策を取ればよいか ということは載っているのですが いまい ち内部まで解説してくれないような印象があります ) Multiple vulnerabilities in Oracle Java 7 before Update 11 allow remote attackers to execut
Java Zero-Day @potetisensei 1. 概要 2012 年 12 月 7 日 Java に新たな脆弱性 ( セキュリティ上の欠陥 ) が発見されました これは CVE-2013-0422 という名前で分類されているものです CVE とは 脆弱性一つ一つを識別するタグのようなものです Java とは プログラミング言語の一つであり 30 億のデバイスで走る Java と称されるように
More informationC , 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 informationJava演習(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- - http://168iroha.net 018 10 14 i 1 1 1.1.................................................... 1 1.................................................... 7.1................................................
More informationDEMO1 まずはやってみよう アクティビティをダブルクリック 作成 - プロジェクト C# => Workflow CodeActivity をぽとぺ シーケンシャルと ステートマシン それぞれのコ ンソールアプリ あとライブラリがある びっくりマークは足りていないあかし プロパティをみると判別で
DEMO1 まずはやってみよう アクティビティをダブルクリック 作成 - プロジェクト C# => Workflow CodeActivity をぽとぺ シーケンシャルと ステートマシン それぞれのコ ンソールアプリ あとライブラリがある びっくりマークは足りていないあかし プロパティをみると判別できます こんなコードを追加 string str = Console.ReadLine(); int
More information1 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 information1.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 information4-3- 基 C++ に関する知識 オープンソースシステムのソースを解読する上で C++ の知識は必須であるといえる 本カリキュラムでは まずオブジェクト指向に関する Ⅰ. 概要理解を深め クラスの扱い方について学習し STL を使用してアルゴリズムとデータ構造を実装する方法を学習する Ⅱ. 対象専
4-3- 基 C++ に関する知識 1 4-3- 基 C++ に関する知識 オープンソースシステムのソースを解読する上で C++ の知識は必須であるといえる 本カリキュラムでは まずオブジェクト指向に関する Ⅰ. 概要理解を深め クラスの扱い方について学習し STL を使用してアルゴリズムとデータ構造を実装する方法を学習する Ⅱ. 対象専門分野職種共通 Ⅲ. 受講対象者 本カリキュラムの 4-2-
More information基礎計算機演習 実習課題No6
実習課題 No.6 課題は 3 題ある. 課題 6-1 時間内提出 次の実行例のように, 名簿を出力するプログラムをつくりたい. このプログラムでは, まず人数をたずね, 次にその人数分の名前を入力し, それを再びコンソールに出力する. なお, 空の名前が入力されても終了せずにその欄は空欄で出力するものとする. 注意とヒント この課題では,string 型の配列をまず宣言する. このとき, 配列の要素はちょうど名簿に入力する人数分だけを宣言すること
More informationSlide 1
OpenFoam のための C/C++ 第 3 回 OpenFoam で勉強るテンプレート 田中昭雄 1 目的 この勉強会の資料があれば OpenFoam カスタマイズ時に C/C++ で迷わない 2 予定 第 1 回メモリ管理 第 2 回 CFDの例で勉強するクラス 第 3 回 OpenFOAMで勉強するテンプレート 第 4 回 OpenFOAMカスタマイズ 第 5 回未定 第 6 回未定 3 今回のテーマ
More informationメディプロ1 Javaプログラミング補足資料.ppt
メディアプロジェクト演習 1 Javaプログラミング補足資料 l Javaとは l JavaScript と Java 言語の違い l オブジェクト指向 l コンストラクタ l 継承 抽象クラス 本資料内のページ番号は, 以下の参考書のページを引用している高橋麻奈 : やさしい Java, ソフトバンククリエイティブ (2,625 円 ) はじめに l プログラミング言語とは? l オブジェクト指向とは?
More informationMicrosoft PowerPoint - prog04.ppt
プログラミング言語 3 第 04 回 (2007 年 10 月 15 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/33 1 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 10 月 15 日分と書いてある部分が 本日の教材です
More informationJavaの作成の前に
メディアプロジェクト演習 1 参考資料 Javaとは JavaScript と Java 言語の違い オブジェクト指向 コンストラクタ サーブレット 本資料内のページ番号は, 以下の参考書のページを引用している 高橋麻奈 : やさしい Java, ソフトバンククリエイティブ (2,625 円 ) はじめに プログラミング言語とは? オブジェクト指向とは? Java 言語とは? JavaとJavaScriptの違いとは?
More information超初心者用
初心者用 C++ 講座 第 1 版 2000 年 11 月 27 日 文責 : 斎藤輪太郎 永安悟史 0. はじめに このテキストでは C++ のごく基本的なことを学びます C++ は C の上位互換言語であり C 言語の長所を生かしつつ オブジェクト指向プログラミングができるので大変強力です このテキストを読むにあたっては C 言語の知識があるとより理解しやすいでしょう 1. 簡単な入力と出力 C++
More informationprogrammingII2019-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 information2008chom.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 informationJavaプログラミングⅠ
Java プログラミング Ⅰ 12 回目クラス 今日の講義で学ぶ内容 クラスとは クラスの宣言と利用 クラスの応用 クラス クラスとは 異なる複数の型の変数を内部にもつ型です 直観的に表現すると int 型や double 型は 1 1 つの値を管理できます int 型の変数 配列型は 2 5 8 6 3 7 同じ型の複数の変数を管理できます 配列型の変数 ( 配列変数 ) クラスは double
More information設問 println はそこで指定されている内容を出力して改行するものである. 一方,print は内容を出力して改行しないものである. 下記のプログラムそれぞれについて出力結果がどうなるか回答せよ. 下記のプログラム - を実行すると, fms という文字列が 回表示される. プログラム - vo
年組番号名前点数 設問 設問 2 設問 3 6 7 8 0 設問 4 6 7 8 0 設問 5 設問 6 2 3 4 5 6 設問 println はそこで指定されている内容を出力して改行するものである. 一方,print は内容を出力して改行しないものである. 下記のプログラムそれぞれについて出力結果がどうなるか回答せよ. 下記のプログラム - を実行すると, fms という文字列が 回表示される.
More informationPowerPoint Presentation
p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight
More informationPowerPoint プレゼンテーション
基本 Java プログラミング演習 第 13 回 担当 : 植村 今後の予定 7/15 第 13 回 今回 7/22 第 14 回 小テスト ( クラス ) 7/29 第 15 回 総まとめテスト レポート提出 期末テストの時間割に Java のテストの欄がありますが無視してください 再テストはまた別途連絡いたします 2 CHAPTER 11 はじめてのクラス前回の復習 クラスクラスを構成する要素
More information10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV
tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
More information.NETプログラマー早期育成ドリル ~VB編 付録 文法早見表~
.NET プログラマー早期育成ドリル VB 編 付録文法早見表 本資料は UUM01W:.NET プログラマー早期育成ドリル VB 編コードリーディング もしくは UUM02W:.NET プログラマー早期育成ドリル VB 編コードライティング を ご購入頂いた方にのみ提供される資料です 資料内容の転載はご遠慮下さい VB プログラミング文法早見表 < 基本文法 > 名前空間の定義 Namespace
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新版明解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基本情報STEP UP演習Java対策
トレーニング編 1. 予約語 extends アクセスレベル class サブクラス名 extends スーパクラス名 { (1) スーパクラス ( 既存のクラス ) を拡張して, サブクラス ( 新しいクラス ) を定義する場合に extends を利用する (2) extends の後ろには, スーパクラスの名前を一つだけ指定できる (3) サブクラスからインスタンスを生成すると, スーパクラスに定義されたインスタンス変数やメソッドがこのインスタンス内部に引き継がれる
More informationWPF アプリケーションの 多言語切替
WPF アプリケーションの 多言語切替 YK S o f t w a r e 2015 年 6 月 2 日 @twyujiro15 プロフィール 加藤裕次郎 本職は製造業の開発業務 - 2009 年 4 月に入社 1982.03.03 生まれ ( うお座 ) 左利き ( お箸は右 ) twitter : @twyujiro15 プログラミング経験 Excel VBA MATLAB MATX C VC++
More informationMicrosoft PowerPoint - class2-OperatorOverLoad.pptx
クラス Class (3) メンバ関数と演算子のオーバロード 上級プログラミング講義資料 成蹊大学理工学部情報科学科 1 多重定義 ( オーバロード ) 関数のオーバロード C++ の関数では シグニチャ ( 関数名, 引数の型および個数のこと ) が異なることによって 同名の関数が複数存在することが出来る 演算子のオーバロード四則演算子をはじめとする演算子を 新たに定義したクラスを取り扱うように多重定義することが出来る
More informationexec.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++入門編
第 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(Eclipse\202\305\212w\202\324Java2\215\374.pdf)
C H A P T E R 11 11-1 1 Sample9_4 package sample.sample11; public class Sample9_4 { 2 public static void main(string[] args) { int[] points = new int[30]; initializearray(points); double averagepoint =
More information基礎プログラミング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 informationMicrosoft PowerPoint - prog03.ppt
プログラミング言語 3 第 03 回 (2007 年 10 月 08 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/33 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 10 月 08 日分と書いてある部分が 本日の教材です
More informationグラフの探索 JAVA での実装
グラフの探索 JAVA での実装 二つの探索手法 深さ優先探索 :DFS (Depth-First Search) 幅優先探索 :BFS (Breadth-First Search) 共通部分 元のグラフを指定して 極大木を得る 探索アルゴリズムの利用の観点から 利用する側からみると 取り替えられる部品 どちらの方法が良いかはグラフに依存 操作性が同じでなければ 共通のクラスの派生で作ると便利 共通化を考える
More information1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i
ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,
More informationMicrosoft PowerPoint Java基本技術PrintOut.ppt [互換モード]
第 3 回 Java 基本技術講義 クラス構造と生成 33 クラスの概念 前回の基本文法でも少し出てきたが, オブジェクト指向プログラミングは という概念をうまく活用した手法である. C 言語で言う関数に似ている オブジェクト指向プログラミングはこれら状態と振る舞いを持つオブジェクトの概念をソフトウェア開発の中に適用し 様々な機能を実現する クラス= = いろんなプログラムで使いまわせる 34 クラスの概念
More informationJavaプログラミングⅠ
Java プログラミング Ⅱ 4 回目クラスの機能 (2) コンストラクタ クラス変数 クラスメソッド課題 確認 問題次の各文は正しいか誤っているか答えなさい (1) コンストラクタはメソッドと同様に戻り値をもつ (2) コンストラクタはオブジェクトが生成されると最初に実行される (3) コンストラクタはメソッドと同様にオーバーロードができる (4) コンストラクタは常に public メンバとしなければならない
More information2017_08_ICN研究会_印刷用
class Producer : noncopyable public: run() m_face.setinterestfilter("/example/testapp", bind(&producer::oninterest, this, _1, _2), RegisterPrefixSuccessCallback(), bind(&producer::onregisterfailed, this,
More informationJavaプログラミングⅠ
Java プログラミング Ⅱ 8 回目抽象クラスとインタフェース課題 確認 問題次の各文は正しいか誤っているか答えなさい (1) 抽象クラスのオブジェクトは生成できる (2) 抽象メソッドとはメソッドの本体が未定義のメソッドである (3) 抽象メソッドをメンバーにもつクラスは抽象クラスである (4) 抽象クラスを拡張してすべての抽象メソッドをオーバーライドすれば サブクラスのオブジェクトを生成できる
More information基礎プログラミング2015
応用プログラミング 第 4 回 ファイル操作 2017 年 10 月 11 日 ( 水 ) 第 6 章 ファイル操作 標準入出力とファイル (P.50) これまでのプログラム 入力 : キーボード 出力 : ディスプレイ Input an integer 1024 1024 標準入出力とファイル (P.50) 今回のプログラム 入力 : ファイル ( の内容 ) 出力 : ファイル Input a
More information1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber();
: : :0757230G :2008/07/18 2008/08/17 1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); private: float num; ;
More informationやさしい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 informationPowerPoint プレゼンテーション
プログラマー勉強会 1 回 basic.h 補足 [ 修飾子 ] const 付けた変数は初期化以外で値を設定することができなくなる 定数宣言に使う unsigned 付けた変数は符号がなくなり 正の値しか設定できない [ 条件コンパイル ] #ifdef M ここ以前に M がマクロとして定義されていれば ここ以下をコンパイルする #ifndef M ここ以前に M というマクロが定義されていなければ
More information問題 01 以下は コンソールより年齢を入力させ その年齢にあった料金を表示するプログラムである 年齢ごとの金額は以下の通りである 年齢の範囲金額 0 歳以上 6 歳以下 120 円 7 歳以上 65 歳未満 200 円 65 歳以上無料 package j1.exam02; import java
問題 01 以下は コンソールより年齢を入力させ その年齢にあった料金を表示するプログラムである 年齢ごとの金額は以下の通りである 年齢の範囲金額 0 歳以上 6 歳以下 120 円 7 歳以上 65 歳未満 200 円 65 歳以上無料 public class Ex0201 { System.out.print("input> "); int input = Integer.parseInt(reader.readLine());
More informationJAVA とテンプレート
JAVA とテンプレート 序論 : コンテナ 他のクラスのオブジェクトを保存するものをコンテナ (Container) と呼ぶ 集合 リスト 表 コンテナに求められる機能 追加 削除 参照 要素の比較 並べ替え 要素のクラスが不明では 比較できない 要素が想定しているクラスのものかの判定 テンプレート以前の対応方法 コンテナ設計時に 保存されるクラスを特定してコンテナをコードする 保存されるクラスごとに作成しなければならない
More information- i - org.t_engine.tenet.core.coreerrormessageexception org.t_engine.tenet.core Class CoreErrorMessageException java.lang.object +-java.lang.throwable +-java.lang.exception +-org.t_engine.tenet.core.coreexception
More informationJavaセキュアコーディングセミナー2013東京第1回 演習の解説
Java セキュアコーディングセミナー東京 第 1 回オブジェクトの生成とセキュリティ 演習の解説 2012 年 9 月 9 日 ( 日 ) JPCERT コーディネーションセンター脆弱性解析チーム戸田洋三 1 演習 [1] 2 演習 [1] class Dog { public static void bark() { System.out.print("woof"); class Bulldog
More informationJavaプログラミングⅠ
Java プログラミング Ⅱ 3 回目クラスの機能 (1) アクセス制限 オーバーロード課題 確認 問題次の各文は正しいか誤っているか答えなさい (1) クラスの private メンバは そのクラスからのみアクセス可能なメンバである (2) 一般に クラスのフィールドはどこからでもアクセスできるように public メンバで宣言すべきである (3) クラスは private メンバと public
More information2 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 informationJavaプログラムの実行手順
戻り値のあるメソッド メソッドには 処理に使用する値を引数として渡すことができました 呼び出し 側からメソッドに値を渡すだけでなく 逆にメソッドで処理を行った結果の値を 呼び出し側で受け取ることもできます メソッドから戻してもらう値のことを もどりち戻り値といいます ( 図 5-4) 図 5-4. 戻り値を返すメソッドのイメージ 戻り値を受け取ることによって ある計算を行った結果や 処理に成功したか失
More informationRHEA 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 informationProgramming-C-9.key
プログラミングC 第9回 例外 スレッド 白石路雄 2 finally try{ ( 例外が発生するかもしれない処理 ) catch(exception のクラス名 e){ ( 例外が発生した時の処理 ) finally{ ( 例外の発生の有無に関わらず 必ず行う処理 ) 3 Integer.parseInt() NumberFormatException
More informationcpp2.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 informationJavaプログラミングⅠ
Java プログラミング Ⅱ 6 回目継承課題 確認 問題次の各文は正しいか誤っているか答えなさい (1) 新しいクラスを宣言するとき既存のクラスを利用することはできない (2) 新しいクラスが既存のクラスのメンバーを受け継ぐことを継承という (3) クラスの拡張における既存のクラスをサブクラスという (4) サブクラスからスーパークラスの private メンバーをアクセスすることはできない (5)
More informationJavaプログラミングⅠ
Java プログラミング Ⅱ 11 回目スレッド課題 確認 問題次の各文は正しいか誤っているか答えなさい (1) スレッドは 1 つの実行箇所をもつ一連の処理の流れである (2) マルチスレッドで各スレッドの処理は並行して実行される (3) Java はマルチスレッド処理を記述できない (4) 新たにスレッドを生成する場合 Thread クラスを拡張し かつ Runnable インタフェースを実装する必要がある
More informationコンパイラ演習 第 7 回
コンパイラ演習 第 7 回 (2010/11/18) 秋山茂樹池尻拓朗前田俊行鈴木友博渡邊裕貴潮田資秀小酒井隆広山下諒蔵佐藤春旗大山恵弘佐藤秀明住井英二郎 今日の内容 Type Polymorphism ( 型多相性 ) の実現について Polymorphism 大きく分けて 3 種類ある Parametric polymorphism Subtyping polymorphism Ad-hoc polymorphism
More informationPowerPoint Presentation
UML 2004 7 9 10 ... OOP UML 10 Copyright 2004 Akira HIRASAWA all rights reserved. 2 1. 2. 3. 4. UML 5. Copyright 2004 Akira HIRASAWA all rights reserved. 3 1..... Copyright 2004 Akira HIRASAWA all rights
More informationデジタル表現論・第4回
デジタル表現論 第 4 回 劉雪峰 ( リュウシュウフォン ) 2016 年 5 月 2 日 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 1 / 14 本日の目標 Java プログラミングの基礎 出力の復習 メソッドの定義と使用 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 2 / 14 出力 Systemoutprint()
More informationJava (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow
Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1
More informationPowerPoint プレゼンテーション
オブジェクト指向 プログラミング演習 第 4 回継承 オーバーライド ポリモルフィズム 今日のお題 継承 オーバーライド ポリモルフィズム 継承 (inherit) あるクラス c のサブクラス s を定義する : このとき s は c を継承していると言う 何かの下位概念を表すクラスは その上位概念を表すクラスの属性や機能を ( 基本的には ) 使える 継承の例 大学生 長崎県立大学の学生 大学生を継承する概念
More information全商情報処理検定プログラミング部門 サンプル問題1級解説
全商情処プロ部門 Java 解説平成 25 年 2 月サンプル問題 1 級 7 ( 映画館の問題 ) 解答 (1)ageNum[age] += num (2)index = age (3)n < m (4)work = list.get(n) (5)i < list.size() 問題を解く前に クラスやメソッドを正確に把握する必要がある 具体的にはクラスやメソッドを四角で囲って視覚的に理解する メソッドを呼び出している個所をマーカーで線を引く
More information新・明解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グラフと組み合わせ 課題 7 ( 解答例 ) 2013/5/27 1 列挙 n 個の文字の集合 { } S = a, a,, an の全てからなる文字列 つまり同じ文字を含まない 長さ n の文字列を列挙する 方法を考える 1. 何通りの文字列があるかを答えなさい また そのことが正しい
グラフと組み合わせ 課題 7 ( 解答例 ) 2013/5/27 1 列挙 n 個の文字の集合 { S = a, a,, an 0 1 1 の全てからなる文字列 つまり同じ文字を含まない 長さ n の文字列を列挙する 方法を考える 1. 何通りの文字列があるかを答えなさい また そのことが正しいことを数学的帰納法で示しなさい 2. 文字列を列挙する再帰的アルゴリズムを構築しなさい 3. n = 4
More informationオブジェクト指向プログラミング・同演習 5月21日演習課題
オブジェクト指向プログラミング 同演習 5 月 21 日演習課題 問題 1 配列の例外処理例外が発生する可能性のある処理を try で囲み その後に catch で例外を捕捉します 例外処理の終了処理として finally が行われます これは書かなくて自動的に行われます 提出課題 1 (Kadai052301.java) 以下のプログラムは例外処理をしていない ArrayIndexOutOfBoundsException
More informationアルゴリズムとデータ構造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問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。
ソフトウェア基礎演習課題 文法理解度確認範囲 問題 1 データ型 ( 変数, データ型 ) 問題 2 制御構造 (switch 文 ) 問題 3 制御構造 (while 文 ) 問題 4 制御構造と配列 ( 総和 ) 問題 5 制御構造と配列 ( 総和, 平均 ) 問題 6 データ型と各種演算子 ( 文字列, 検索 ) 問題 7 クラスの定義 ( メソッドの定義, コンストラクタの定義, キャスト
More information10K pdf
#1 #2 Java class Circle { double x; // x double y; // y double radius; // void set(double tx, double ty){ x = tx; y = ty; void set(double tx, double ty, double r) { x = tx; y = ty; radius = r; // Circle
More information