演習1

以下のプログラムを実行する前に、結果を予測して、実行してみて予測と結果を比べてみなさい。

100
-96
3
3
0
1.04667
1
演習2

1.C++で使える基本の型をすべて挙げなさい。
char, short, int, long, float, double, bool
2.以下のような問題があった時、用意しなければならない変数を考えなさい。

  • 1~100の和をカウンタ変数を1からカウントアップすることにより求める
//カウンタ 
int i
//和 
int sum
  • 底辺と高さを入力し、三角形の面積を計算する
//底辺
float bottom
//高さ
float height
//面積
float area;
  • 座標P1(x1, y1)とP2(x2, y2)を入力して、その2点を通る直線の傾きを求める
//座標
float x1, x2, y1, y2
//傾き
float tangent;
  • ax2+bx+c=0の解の個数を求める処理
//係数用の変数
float a, b, c
//判別氏起用の変数
float d
  • game-engineer/classes/2021/game-programing-1/answers/answer-1.txt
  • 最終更新: 4年前
  • by root