0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

独習プログラミングの備忘録 4 後編 【制御構文のバリエーション】

Posted at

~学んだこと~
・for文の基本
  for (初期値; 繰り返す回数; 増やすまたは減らす数)
  ex: for(int a = 0; i < 10; i++ ≪i--≫) {...

・break文は、繰り返し自体を中断する

・continue文は、現在の回のみを中断し次の回へ

・goto文は望むところへ制御を飛ばすことができるが、多用するとプログラムの構成が複雑化し原因の特定が困難になる可能性がある

~感じたこと~
プログラム.PNG

九九の表を出力するプログラムを模写コーディングしてみたが、8行目の"%2d"の2がどのような役割をしているのか、あまり理解できていない。

"%2d"のとき
テスト2.PNG

"%d"のとき
テスト3.PNG

2つの画像から"%2d"はスペースを入れる役割と推測するが、参考書にはこのことについて記されていないため確証が持てない。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?