• 検索結果がありません。

プログラミング基礎 第

N/A
N/A
Protected

Academic year: 2021

シェア "プログラミング基礎 第"

Copied!
1
0
0

読み込み中.... (全文を見る)

全文

(1)

プログラミング基礎 第

1

回 (担当: 山下,大竹)

10 月9日

http://lecture.ecc.u-tokyo.ac.jp/~tohtake/を参照してください.

1.テキスト

情報システム第1(鈴木宏正)

http://lecture.ecc.u-tokyo.ac.jp/~tohtake/cmain1.pdf

2.第1回のテーマは「エディタの使用とプログラムの実行」

課題1 6ページまでのプログラム(hello.c hello2.c fahren.c)をエディタで入力,コンパイルして実行してくだ さい.

課題2 printfの書式は色々あります.

Googleなどでprintfを検索してみてください(自分でマニュアルを調べる練習です).

“%f”を“%d”に書きかえたらどうなるでしょうか.

課題3 fahren.cで換算する華氏温度に色々な値を入力して,結果の表示が見やすくなるよう工夫してみてくだ さい

課題4 fahren.cで3行にわたって表示される数値を小数点の位置をそろえて表示することを考えます.

“is”の部分をそろえるにはprintf文中の空白を調整すれば良いのですが,数値部分を数値にかかわらず

小数点ぞろえにするにはどうしたら良いでしょうか?(例えば100Fを10000Fにして試してください).

printfのマニュアルから関連する情報を探して試してみてください.

キーワードは 「フィールド幅(数値の文字数が少なくても最低限確保される幅)」

「精度(小数点何桁まで表示するか)」 などです.

課題5 エスケープシーケンスを使ってみてください.

次のprintf文の結果はどうなるでしょうか?

printf("¥033[34mtest¥033[0m¥n");

googleで「ansi エスケープシーケンス」を検索してみてください.

そもそもエスケープシーケンスとは?

エディタでソースプログラムを編集する,コンパイルして実行する,出力結果を見やすく表示するよう工夫する,

ことができるようになったらOKです.アンケートに記入して提出して下さい.

参考1:プログラムの入力・コンパイル・実行

emacs をプログラムから選択し、ファイルをオープン。

gcc ファイル名 ./a.exe

参考2:emacsコマンド

ファイルのセーブ Ctrl+x Ctrl+s エディタの終了 Ctrl+x Ctrl+c キャンセル Ctrl+g

(↑コマンド入力を間違えてわけが分からなくなったとき)

参考4:プログラム例の訂正

void main(void)の部分は全てint main(void)とする.

参考5:自分のWindowsPCでプログラミングしたい まずは、Cygwinを使うことを勧めます。

http://lecture.ecc.u-tokyo.ac.jp/~tohtake/cygwin.pdf

※ Microsoft の Visual Studio 上でのコンパイルやデバックの方法は慣れてきたら説明します。

参照

関連したドキュメント

We prove a continuous embedding that allows us to obtain a boundary trace imbedding result for anisotropic Musielak-Orlicz spaces, which we then apply to obtain an existence result

Let X be an admissible Riemannian complex and G be a finitely generated group with with polynomial volume growth such that X/G = Y is a finite polytopal complex satisfying

More general problem of evaluation of higher derivatives of Bessel and Macdonald functions of arbitrary order has been solved by Brychkov in [7].. However, much more

Algebraic curvature tensor satisfying the condition of type (1.2) If ∇J ̸= 0, the anti-K¨ ahler condition (1.2) does not hold.. Yet, for any almost anti-Hermitian manifold there

of absolute CR -epic spaces: a Tychonoff space X is absolute CR -epic if for any dense embedding X  // Y into another Tychonoff space, the induced C(Y ) // C(X) is an epimorphism in

In Subsection 5.1 we show the continuity of the Dirichlet heat kernel associated with the killed LBM on a bounded open set by using its eigenfunction expansion, and in Subsection 5.2

Using the previous results as well as the general interpolation theorem to be given below, in this section we are able to obtain a solution of the problem, to give a full description

Definition 28 (Toric family problem on toric surfaces) Given a complex embedded toric surface X find the minimal toric degree v(X) and the set of optimal toric families