c++学習ノート(1)helloworld


前言
今日は私の入社初日で、もちろんとても楽しくて、部門は私にいくつかの資料を見せて、私は今日私がいくつかの自分の知識を記録しなければならないと思って、私が努力して勉強する心を表明します.
hello world
その歴史は私は自分のブログに書きたくありません.つまらないです.では、今ここで自分が書いたコードを展示します.
    #include <iostream>

    /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    using namespace std;
     int main(int argc, char *argv[]) {
	   cout << "this is c++";
	   return 0;
     }

では、今あなたが見ているのは私が書いた最初のC++プログラムです.このプログラムにはヘッダファイルiostreamが含まれています.coutにより出力機能を実現できます.
ただし、名前空間stdを使用するにはusing namespace stdが必要です.
関数参照
C++言語では関数応用は実はC言語と同じ外部申明関数体であり,内部呼び出し関数でよい.
    #include <iostream>

    /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    using namespace std;
     int max(int a,int b){
	int z;
	if(a > b){
		z = a; 
		} else{
			z = b;
		}
        return z;
     }
     int main(int argc, char *argv[]) {
	int a,b,maxnum;
	cin >> a>> b;
	maxnum = max(a,b);
	cout<<"max num ="<<maxnum; 	
	return 0;
   }