<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/wildbored/">
    <title>wildbored @Wiki</title>
    <link>http://w.atwiki.jp/wildbored/</link>
    <atom:link href="https://w.atwiki.jp/wildbored/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>wildbored @Wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2006-06-16T02:08:19+09:00</dc:date>
    <utime>1150391299</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/6.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/4.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/8.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/7.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/5.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/1.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/2.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/wildbored/pages/3.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/6.html">
    <title>Structure of a program</title>
    <link>https://w.atwiki.jp/wildbored/pages/6.html</link>
    <description>
      *Structure of a program

プログラミング言語を学ぶ一番いい方法はプログラムを書くことですので、最初のプログラムを以下に載せます。

 // my first program in C++
 
 #include &lt;iostream&gt;
 using namespace std;
 
 int main ()
 {
  　cout &lt;&lt; &quot;Hello World!&quot;;
  　return 0;
 }

 Hello World!


最初のパネルはプログラムのソースコードです。次のパネルはプログラムをコンパイルし実行した結果です。プログラムを編集したりコンパイルする方法はあなたが使っているコンパイラに依ります。開発環境があるかないかや、またコンパイラのバージョンにもまた左右されます。C++でのコンソールアプリケーションをどうやってコンパイルすればいいのかが分からない場合は、[[Compilers&gt;Instructions for use#Compilers]]を参考にしたり、あなたが使っているコンパイラのマニュアルやヘルプも参考にしてください。


このプログラムはプログラマーが新しい言語などを習得するときに最初に書く典型的なプログラムで、スクリーンに&quot;Hello World!&quot;と1行表示します。C++で書ける最も単純なプログラムですが、どのC++のプログラムも持っている基本的な要素はすでに含まれています。1行1行コードをおっていきます。

:// my first program in C++ |
1行コメントです。スラッシュが2つ(//)で始まっている全ての1行はコメントと解釈され、プログラムの振る舞いになんら影響を及ぼしません。プログラマーはコメントを使ってソースコード中に短く説明や意図を含ませることができます。ここでは、このプログラムが何であるか概要を解説しています。


:#include &lt;iostream&gt; |
　#で始まっている1行はプリプロセッサに指示を与えます。つまり、＃で始まっている行はなんらかの式としての1行ではなくコンパイラのプリプロセッサに対して指示を与えます。ここでは、#include &lt;iostream&gt;の指示はプリプロセッサに iostream のヘッダファイルをインクルードすることです。この iostream のヘッダファイルはC++で基本的な入力と出力を宣言が記述されています。そして、後のプログラム中で必要となる機能のためにインクルードされています。

:using namespace std;| 
標準的なC++のライブラリ要素全てのnamespaceと呼ばれるものを宣言しています。ここでのnamespaceはstdを使われるようにするためです。つまり、stdの機能を使うために、using namespaceの式を宣言することでライブラリの実体を使えるようになります。標準的なライブラリをつかうためにこのusingの1行はC++でよく使われます。実際に、チュートリアル中の多くのソースコードでよく含まれています。

:int main ()| 
This line corresponds to the beginning of the definition of the main function. The main function is the point by where all C++ programs start their execution, independently of its location within the source code. It does not matter whether there are other functions with other names defined before of after it - the instructions contained within this function&#039;s definition will always be the first ones to be executed in any C++ program. For that same reason, it is essential that all C++ programs have a main function.
The word main is followed in the code by a pair of parentheses (()). That is because it is a function declaration: In C++, what differentiates a function declaration from other types of expressions are these parentheses that follow its name. Optionally, these parentheses may enclose a list of parameters within them.

Right after these parentheses we can find the body of the main function enclosed in braces ({}). What is contained within these braces is what the function does when it is executed.


:cout &lt;&lt; &quot;Hello World&quot;;| 
This line is a C++ statement. A statement is a simple or compound expression that can actually produce some effect. In fact, this statement performs the only action that generates a visible effect in our first program.
cout represents the standard output stream in C++, and the meaning of the entire statement is to insert a sequence of characters (in this case the Hello World sequence of characters) into the standard output stream (which usually is the screen).

cout is declared in the iostream standard file within the std namespace, so that&#039;s why we needed to include that specific file and to declare that we were going to use this specific namespace earlier in our code.

Notice that the statement ends with a semicolon character (;). This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).


:return 0; |
The return statement causes the main function to finish. return may be followed by a return code (in our example is followed by the return code 0). A return code of 0 for the main function is generally interpreted as the program worked as expected without any errors during its execution. This is the most usual way to end a C++ program.

You may have noticed that not all the lines of this program perform actions when the code is executed. There were lines containing only comments (those beginning by //). There were lines with directives for the compiler&#039;s preprocessor (those beginning by #). Then there were lines that began the declaration of a function (in this case, the main function) and, finally lines with statements (like the insertion into cout), which were all included within the block delimited by the braces ({}) of the main function.

The program has been structured in different lines in order to be more readable, but in C++, we do not have strict rules on how to separate instructions in different lines. For example, instead of 

 int main ()
 {
   cout &lt;&lt; &quot; Hello World &quot;;
   return 0;
 }
 


We could have written:

 int main () { cout &lt;&lt; &quot;Hello World&quot;; return 0; } 


All in just one line and this would have had exactly the same meaning as the previous code.

In C++, the separation between statements is specified with an ending semicolon (;) at the end of each one, so the separation in different code lines does not matter at all for this purpose. We can write many statements per line or write a single statement that takes many code lines. The division of code in different lines serves only to make it more legible and schematic for the humans that may read it.

Let us add an additional instruction to our first program:

 // my second program in C++
 
 #include &lt;iostream&gt;
 
 using namespace std;
 
 int main ()
 {
   cout &lt;&lt; &quot;Hello World! &quot;;
   cout &lt;&lt; &quot;I&#039;m a C++ program&quot;;
   return 0;
 }

 Hello World! I&#039;m a C++ program
 


In this case, we performed two insertions into cout in two different statements. Once again, the separation in different lines of code has been done just to give greater readability to the program, since main could have been perfectly valid defined this way:

 int main () { cout &lt;&lt; &quot; Hello World! &quot;; cout &lt;&lt; &quot; I&#039;m a C++ program &quot;; return 0; } 
 


We were also free to divide the code into more lines if we considered it more convenient: 

 int main ()
 {
   cout &lt;&lt;
     &quot;Hello World!&quot;;
   cout
     &lt;&lt; &quot;I&#039;m a C++ program&quot;;
   return 0;
 }
 


And the result would again have been exactly the same as in the previous examples.

Preprocessor directives (those that begin by #) are out of this general rule since they are not statements. They are lines read and discarded by the preprocessor and do not produce any code by themselves. Preprocessor directives must be specified in their own line and do not have to end with a semicolon (;).


Comments
Comments are parts of the source code disregarded by the compiler. They simply do nothing. Their purpose is only to allow the programmer to insert notes or descriptions embedded within the source code. 

C++ supports two ways to insert comments: 

 // line comment
 /* block comment */ 
 


The first of them, known as line comment, discards everything from where the pair of slash signs (//) is found up to the end of that same line. The second one, known as block comment, discards everything between the /* characters and the first appearance of the */ characters, with the possibility of including more than one line.
We are going to add comments to our second program: 

 /* my second program in C++
    with more comments */
 
 #include &lt;iostream&gt;
 using namespace std;
 
 int main ()
 {
   cout &lt;&lt; &quot;Hello World! &quot;;     // prints Hello World!
   cout &lt;&lt; &quot;I&#039;m a C++ program&quot;; // prints I&#039;m a C++ program
   return 0;
 }

 Hello World! I&#039;m a C++ program
 


If you include comments within the source code of your programs without using the comment characters combinations //, /* or */, the compiler will take them as if they were C++ expressions, most likely causing one or several error messages when you compile it.    </description>
    <dc:date>2006-06-16T02:08:19+09:00</dc:date>
    <utime>1150391299</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/4.html">
    <title>C++ Language Tutorial</title>
    <link>https://w.atwiki.jp/wildbored/pages/4.html</link>
    <description>
      *C++ Language Tutorial

このチュートリアルはC++(ANSI-C++)についてです。基本として配列やクラス、応用として継承やテンプレートについて説明しています。実用性を重視し、全てのセクションで動作可能なコードの例をつけています。

**[[Introduction&gt;Introduction]] 
-[[Instructions for use&gt;Instructions for use]] 
**[[Basics of C++&gt;Basics of C++]] 
-[[Structure of a program&gt;Structure of a program]]
-[[Variables. Data Types.&gt;Variables. Data Types.]] 
-[[Constants&gt;Constants]] 
-[[Operators&gt;Operators]]
-[[Basic Input/Output&gt;Basic Input/Output]]
**Control Structures 
-[[Control Structures&gt;Control Structures]] 
-[[Functions (I)&gt;Functions (I)]]
-[[Functions (II)&gt;Functions (II)]]
**Compound Data Types 
-[[Arrays&gt;Arrays]]
-[[Character Sequences&gt;Character Sequences]] 
-[[Pointers&gt;Pointers]]
-[[Dynamic Memory&gt;Dynamic Memory]]
-[[Data Structures&gt;Data Structures]]
-[[Other Data Types&gt;Other Data Types]]
**Object Oriented Programming 
-[[Classes (I)&gt;Classes (I)]]
-[[Classes (II)&gt;Classes (II)]]
-[[Friendship and inheritance&gt;Friendship and inheritance]]
-[[Polymorphism&gt;Polymorphism]]
**Advanced Concepts 
-[[Templates&gt;Templates]] 
-[[Namespaces&gt;Namespaces]]
-[[Exceptions&gt;Exceptions]]
-[[Type Casting&gt;Type Casting]] 
-[[Preprocessor directives&gt;Preprocessor directives]]
**C++ Standard Library 
-[[Input/Output with files&gt;Input/Output with files]]    </description>
    <dc:date>2006-06-16T00:07:36+09:00</dc:date>
    <utime>1150384056</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/8.html">
    <title>Basics of C++</title>
    <link>https://w.atwiki.jp/wildbored/pages/8.html</link>
    <description>
      *Basics of C++
-[[Structure of a program&gt;Structure of a program]] 
-[[Variables. Data Types.&gt;Variables. Data Types.]]
-[[Constants&gt;Constants]]
-[[Operators&gt;Operators]]
-[[Basic Input/Output&gt;Basic Input/Output]]    </description>
    <dc:date>2006-06-15T20:38:31+09:00</dc:date>
    <utime>1150371511</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/7.html">
    <title>Introduction</title>
    <link>https://w.atwiki.jp/wildbored/pages/7.html</link>
    <description>
      *Introduction
-[[Instructions for use&gt;Instructions for use]]    </description>
    <dc:date>2006-06-15T20:36:36+09:00</dc:date>
    <utime>1150371396</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/5.html">
    <title>Instructions for use</title>
    <link>https://w.atwiki.jp/wildbored/pages/5.html</link>
    <description>
      *Instructions for use

**このチュートリアルが誰にとって役に立つものか？
C++でプログラミングを学びたい人にとって役に立ちます。他のプログラミング言語についての知識を持っている必要はないです。もちろん他のプログラミング言語の知識や一般的なコンピュータ技術があればチュートリアルをより理解しやすいでしょう。しかし、絶対に必要なことではありません。また、C++の新しく加わった機能を学びたい人にとっても適切なチュートリアルであります。

チュートリアルの最初の3パートはC++でのC言語の機能についてを説明しますので、C言語になじみのある人にとってはC言語の復習となるでしょう。しかし、C++の文法はC言語とは若干違う部分があり、最初の3パートを読んでみることは大切だと思います。

4番目のパートはオブジェクト指向でのプログラミングについて説明します。

5番目のパートはANSI-C++の新しい機能について紹介します。

**Structure of this tutorial
チュートリアルは6つのパートにわかれています。また、1つのパートもセクションごとにわかれていて、セクションはそれぞれ１つのトピックを取り上げています。左のサイドバーから各セクションを直接選んで見ることもでき、各リンクからチュートリアルを始めてもかまいません。

セクションにはパートの中で新しく説明している言語の機能を使ったコードを例として載せています。次のパートにいく前にこのコードを1行ずつ読み、新しい機能がどのようにコード中で構成されているか理解してください。

プログラム言語学ぶ上で経験を積むよりよい方法はプログラム例を変更したり、新たに機能を加えることです。チュートリアルに乗せているプログラムコードをできる限り変更してみる。それがプログラム言語を学ぶということです。

**Compatibility Notes
ANSI-C++で国際規格に承認されたのはごく最近のことです。最初に公告されたのは1997年11月であり、2003年に改定されました。しかしそれでも、C++は昔から(1980年代)あったわけです。つまり、ANSI-C++の新しい機能を全てサポートしているコンパイラは多くなく、特に新しく追加された機能ほどサポートされていません。

このチュートリアルでは最近のコンパイラがある程度サポートしているANSI－C++の機能について説明します。商用でも非商用でも多くのコンパイラがあるので、あなたが使っているコンパイラがチュートリアルで説明している機能をもしサポートしていないならば、できるだけこれら機能を扱えるコンパイラを用意することを勧めます。

とにかくこの最新のチュートリアルでは古いコンパイラとの互換性はあるはずです。

**&amp;aname(Compilers)Compilers
このチュートリアルに載せているサンプルコードは全てコンソールアプリケーションです。つまり、ユーザと対話したり、結果を返すときにはテキスト形式を用いています。

C++のコンパイラは全てコンソールアプリケーションをコンパイルできるので、あなたの使っているコンパイラのユーザマニュアルを確認して、より詳しいコンパイラの使い方を学んでください。    </description>
    <dc:date>2006-06-15T20:14:12+09:00</dc:date>
    <utime>1150370052</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/1.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/wildbored/pages/1.html</link>
    <description>
      -ウィキはみんなで気軽にホームページ編集できるツールです。
-このページは自由に編集することができます。
-メールで送られてきたパスワードを用いてログインすることで、各種変更（サイト名、トップページ、メンバー管理、サイドページ、デザイン、ページ管理、等）することができます


■　新しいページを作りたい！！
-ページの下や上に「新規作成」というリンクがあるので、それをクリックしてください。

■　表示しているページを編集したい！
-ページ上の「このページを編集」というリンクや、ページ下の「編集」というリンクを押してください。

■　ブログサイトの更新情報を自動的に載せたい！！
-[[お気に入りのブログのRSSを使っていつでも新しい情報を表示できます。詳しくはこちらをどうぞ。&gt;http://atwiki.jp/tools/blogrssmaker.html]]

■　ニュースサイトの更新情報を自動的に載せたい！！
-[[RSSを使うと簡単に情報通になれます、詳しくはこちらをどうぞ。&gt;http://atwiki.jp/tools/rssmaker.html]]

■　その他にもいろいろな機能満載！！
-[[詳しくは、FAQ・初心者講座@wikiをみてね☆&gt;http://www1.atwiki.jp/faq/]]


**分からないことは？
-[[@wikiの詳しい使い方はヘルプ・FAQ・初心者講座@wikiをごらんください。メールでのお問い合わせも受け付けております。&gt;http://www1.atwiki.jp/faq/]]
-[[ユーザ同士のコミュニケーションにはたすけあい掲示板をご利用ください&gt;http://bbs.atwiki.jp/]]
    </description>
    <dc:date>2006-06-15T18:17:44+09:00</dc:date>
    <utime>1150363064</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/wildbored/pages/2.html</link>
    <description>
      メニュー
-[[トップページ]]
-[[メニュー]]
-[[メニュー2]]

    </description>
    <dc:date>2006-06-15T18:17:44+09:00</dc:date>
    <utime>1150363064</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/wildbored/pages/3.html">
    <title>メニュー2</title>
    <link>https://w.atwiki.jp/wildbored/pages/3.html</link>
    <description>
      **更新履歴
#recent(20)
    </description>
    <dc:date>2006-06-15T18:17:44+09:00</dc:date>
    <utime>1150363064</utime>
  </item>
  </rdf:RDF>
