-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBai11.cpp
More file actions
35 lines (30 loc) · 759 Bytes
/
Bai11.cpp
File metadata and controls
35 lines (30 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Cấu trúc rẽ nhánh trong C++
if(điều kiện){
// Nội dung thực hiện nếu đk đúng
} else {
// Nội dung thực hiện nếu điều kiện sai
}
Sinh viên A có điểm trung bình môn là t, điểm để qua môn đó là 4.0
Viết chương trình kiểm tra xem anh A có qua môn hay không.
*/
#include <iostream>
using namespace std;
#define PASS 4.0
#define GOOD 8.0
#define MEDIUM 6.5
int main() {
float t = 5.5f;
if (t >= GOOD) {
cout << "A is Good student!" << endl;
}
else if(t >= MEDIUM && t < GOOD ) {
cout << "A is a medium student!" << endl;
}
else if(t >= PASS && t < MEDIUM) {
cout << "A passed this subject!" << endl;
}
else {
cout << "A failed this subject!" << endl;
}
return 0;
}