// この行はコメントになります /* ここから int a; ここまではコメントになります */ // 今日のお題 世界で一番有名なプログラム // helloworld.cpp //表示の魔法を使えるように詠唱 #include <iostream> //メインプログラムの作成(エントリポイント) int main() { int height = 3, bottom = 4; int area; area = (bottom * height) / 2; std::cout << "area = " << area << std::endl; //std::cout << "hello, world!" << std::endl; return 0; }
改良したやつ
// この行はコメントになります /* ここから int a; ここまではコメントになります */ // 今日のお題 世界で一番有名なプログラム // helloworld.cpp //表示の魔法を使えるように詠唱 #include <iostream> //メインプログラムの作成(エントリポイント) int main() { int height = 3, bottom = 4; int area; // = が代入演算子 //例 height に 7 // bottom に 2 を代入して結果を確認する! //height = 7; //bottom = 2; std::cout << "heightを入力:"; //heightの入力処理 std::cin >> height; std::cout << "bottomを入力:"; //bottomの入力処理 std::cin >> bottom; area = (bottom * height) / 2; //heightとbottomも表示してみよう! std::cout << "height = " << height << std::endl; std::cout << "bottom = " << bottom << std::endl; std::cout << " area = " << area << std::endl; //std::cout << "hello, world!" << std::endl; return 0; }
すぐ終わっちゃったよって人は
を表示するにはどうしたらいいか調べてみよう!