Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
基礎情報処理演習 (7)演算子と分岐
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
自然言語処理研究室
October 31, 2013
Programming
8.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
基礎情報処理演習 (7)演算子と分岐
自然言語処理研究室
October 31, 2013
More Decks by 自然言語処理研究室
See All by 自然言語処理研究室
データサイエンス14_システム.pdf
jnlp
0
420
データサイエンス13_解析.pdf
jnlp
0
550
データサイエンス12_分類.pdf
jnlp
0
380
データサイエンス11_前処理.pdf
jnlp
0
510
Recurrent neural network based language model
jnlp
0
190
自然言語処理研究室 研究概要(2012年)
jnlp
0
170
自然言語処理研究室 研究概要(2013年)
jnlp
0
130
自然言語処理研究室 研究概要(2014年)
jnlp
0
160
自然言語処理研究室 研究概要(2015年)
jnlp
0
240
Other Decks in Programming
See All in Programming
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
260
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
110
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
440
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
150
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
Building an Out-of-Order CPU
latte72
1
760
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.8k
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
150
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
130
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
290
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Featured
See All Featured
Design in an AI World
tapps
1
310
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
230
Building AI with AI
inesmontani
PRO
1
1.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Rails Girls Zürich Keynote
gr2m
96
14k
GraphQLとの向き合い方2022年版
quramy
50
15k
Navigating Weather and Climate Data
rabernat
0
520
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
基礎情報処理演習 (7) 演算子と分岐 山本和英 長岡技術科学大学 1
演算子 (一部再掲) 2
(再掲)演算子 演算子とは、計算などをする記号のことです。 (再掲)算術演算子 + 加算 - 減算 * 乗算 /
除算 % 余り (7 % 3 = 1) 3
(再掲)割り算に注意! 整数どうしの除算時には注意。例えば、 printf (“%f\n”, 5/7); を実行すると、0.0000 が出力されるので、小数 点以下も出力させたい時は下記のように書く。 printf (“%f\n”,
(double) 5/7); 4
関係演算子 <, <= (≦) >, >= (≧) の4つ。 等価演算子 == 等しい
(代入演算子 = と混同しないこと) != 等しくない 5
論理演算子 && かつ AND || もしくは OR ! ~以外 NOT
インクリメント・デクリメント演算子 ++ 加算 a++; a+=1; a=a+1; -- 減算 a--; a-=1; a=a-1; 6
(再掲)キャスト演算子 型変換したい時に使う。 printf (“%f\n”, (double) 5 / 7); 整数の 5
を実数 (5.0) と理解することで、 割り算を実数で行う。 7
(再掲)代入演算子 単純代入演算子: = p = 0; // 普通の使い方 a =
b = 3; // 多重代入もできる 複合代入演算子: += -= *= /= など k += 1; // k=k+1; と同じ 8
if文による分岐 9
if (条件){ }else{ } 10 if文の繰り返し 条件
if (条件1){ }else if(条件2){ }else{ } 11 else if による多方向分岐 条件1
条件2 その他
条件には何を書くか? aa > 100 シンプルな例 a<10 && b<20 論理演算子を使った例 a
a!=0 (下記参照) 気になる人に補足 if文の条件部は、条件が正しいかどうかという「計算」をしている。 つまり条件判断もC言語にとっては「計算」である。そして、「計算」 した結果正しければ1(0以外)、間違っていれば0を返す。もし if (a) などと書くとaの値自身が条件判断の結果と理解し、その値が 0でなければ条件が正しいという意味になるので、し、はaの値が0 でなければ if(a!=0)と同じ意味になる、というわけ。 12
while文による繰り返し 13
while (条件){ } 14 while文の繰り返し 条件
do-while文による繰り返し 15
do { } while (条件); 16 do-while文の繰り返し 条件
break と continue 17
while (…){ … if (条件) break; … } 18 break文はループを終了させる
ループを 完全に やめてしまう
while (…){ … if (条件) continue; … } 19 continue文はループをスキップ
ループ1回分の 残りをパス ここの処理を 1回分飛ばす
breakとcontinueの使い方 • 繰り返しを行う for文、while文、do-while文の 中で使えます。 • だいたい if (条件) break;
あるいは if (条件) continue; などと if文とセットで使 います。 • 2重以上のループの中でbreakを使うと、一番内 側のループ一つだけ抜けます。一気に全部抜け たりはしません。 • for(;;) や while(1) などの無限ループを抜け 出す時にbreak文をよく使います。 20