C# MM14A141 ― 2007年04月19日 19:36
本日は、教室にはいるとえーっという叫び声が聞こえました。
<C#の環境作成>
OS・・・WindowsXP SP2
C#・・・Visual Studio .Net 2005または
C# Express
エディター
oh13サーバー上にC# Express ISO イメージが Upload
してあります。
Downloadして、ISO Busterでコピーします
英語のメッセージがでます。
よく読むと、開きます。
ISOイメージを画面左側のフレームにドラッグします。
ディレクトリーツリーがでます。
VCSフォルダーが2つでます。
下の青いフォルダーにカーソルを合わせて右クリックすると
Extract VCSというメニューが先頭に表示されます。
それを押すとコピーを始めます。
コピーする場所はC:/CSharpとかがいいと思います。
で、VCSフォルダーができるので
setup.exeをダブルクリックします。
インストールするものがでますので、
すべてインストールしてください。
.NET Frame Work2.0とかも一緒にインストールします。
インストールが終了するとC#が起動します。
<授業内容>
ファイル->新しいプロジェクト->コンソールアプリ
プロジェクト名をconapp1にする
ソリューションを閉じると
Save画面がでますのでC:/CSharpに保存してください。
Program.csというソースコードファイルができてます。
Mainメソッドのなかに自己紹介を書きます。
文字列型はstring
string a=”はじめまして”;
Console.WriteLine(a);
.
<C#の環境作成>
OS・・・WindowsXP SP2
C#・・・Visual Studio .Net 2005または
C# Express
エディター
oh13サーバー上にC# Express ISO イメージが Upload
してあります。
Downloadして、ISO Busterでコピーします
英語のメッセージがでます。
よく読むと、開きます。
ISOイメージを画面左側のフレームにドラッグします。
ディレクトリーツリーがでます。
VCSフォルダーが2つでます。
下の青いフォルダーにカーソルを合わせて右クリックすると
Extract VCSというメニューが先頭に表示されます。
それを押すとコピーを始めます。
コピーする場所はC:/CSharpとかがいいと思います。
で、VCSフォルダーができるので
setup.exeをダブルクリックします。
インストールするものがでますので、
すべてインストールしてください。
.NET Frame Work2.0とかも一緒にインストールします。
インストールが終了するとC#が起動します。
<授業内容>
ファイル->新しいプロジェクト->コンソールアプリ
プロジェクト名をconapp1にする
ソリューションを閉じると
Save画面がでますのでC:/CSharpに保存してください。
Program.csというソースコードファイルができてます。
Mainメソッドのなかに自己紹介を書きます。
文字列型はstring
string a=”はじめまして”;
Console.WriteLine(a);
.
c++ コーディング雛形 ― 2007年04月19日 21:14
<c++の特徴>
標準ライブラリー(STL スタンダードテンプレートライブラリー)
動的に配列を管理するコンテナー(vectorなど)・・・格納
アルゴリズム・・・配列の処理 sortなど
イテレーター…繰り返し処理
アダプター
関数オブジェクトなどがあります
基本的に文字列配列はvectorコンテナークラスをつかいます。
//C++のヘッダー
#include <iostream>
#include <string>
//名前空間はstdといいます
using namespace std;
メイン関数
#include <iostream>
#include <string>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
return 0;
}
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
vector<string> array; // string型の動的配列
array.push_back("Mary");
array.push_back("Jhon");
array.push_back("Ken");
sort(array.begin(),array.end());
for( i = 0; i < 3; ++i )
{
cout << array[i] << endl;
}
return !true;
}
標準ライブラリー(STL スタンダードテンプレートライブラリー)
動的に配列を管理するコンテナー(vectorなど)・・・格納
アルゴリズム・・・配列の処理 sortなど
イテレーター…繰り返し処理
アダプター
関数オブジェクトなどがあります
基本的に文字列配列はvectorコンテナークラスをつかいます。
//C++のヘッダー
#include <iostream>
#include <string>
//名前空間はstdといいます
using namespace std;
メイン関数
#include <iostream>
#include <string>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
return 0;
}
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
vector<string> array; // string型の動的配列
array.push_back("Mary");
array.push_back("Jhon");
array.push_back("Ken");
sort(array.begin(),array.end());
for( i = 0; i < 3; ++i )
{
cout << array[i] << endl;
}
return !true;
}
C++ STLの利用 ― 2007年04月19日 21:49
C++の特徴
標準テンプレートライブラリー(STL)があります。
コンテナー(配列を動的にヒープ領域に格納)vactor listなど
アルゴリズム(配列の要素の処理) sort
イテレーター(繰り返し処理)
アダプター
関数オブジェクトなどがあります。
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
vector<string> array; // string型の動的配列
array.push_back("Mary");
array.push_back("Jhon");
array.push_back("Ken");
sort(array.begin(),array.end());
for( i = 0; i < 3; ++i )
{
cout << array[i] << endl;
}
return !true;
}
標準テンプレートライブラリー(STL)があります。
コンテナー(配列を動的にヒープ領域に格納)vactor listなど
アルゴリズム(配列の要素の処理) sort
イテレーター(繰り返し処理)
アダプター
関数オブジェクトなどがあります。
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
string a[]={"c++はじめまして ",
"私 XMENともうします",
"よろしくお願いします"
};
for(int i=0; i<3; i++){
cout << a[i] << endl;
}
vector<string> array; // string型の動的配列
array.push_back("Mary");
array.push_back("Jhon");
array.push_back("Ken");
sort(array.begin(),array.end());
for( i = 0; i < 3; ++i )
{
cout << array[i] << endl;
}
return !true;
}
最近のコメント