1.要做好一件事情或编好控制程式,首先要规划好,也就是算法。
数据结构 + 算法 = 程序
顺序结构:第一条语句开始,一句一句地执行到完成。
编写程序,计算一个学生数学、语文、英语三门课的平均成绩。
int math,chinese,english;
float sum;
input (math,chinese,english);
sum=(math+chinese+english)/3;
out sum;
布尔变量:只能为true 或false
C# 中用逻辑运算符“&&”表示“且”运算也称为“与”运算。
只有都为true时才为true.
C# 中用逻辑运算符“||”表示“或”运算
只要有一个为true就为true
非(not)C#中用逻辑运算符“!”表示“非”运算
true变false,tfalse变true.
通过逻辑运算后才能进行选择,循环算法。
选择结构--if语句
C#中,if语句后的条件必须是一个逻辑表达式