ในบทช่วยสอนนี้ เราจะพูดถึงโปรแกรมสำหรับหาสมาชิกที่น้อยที่สุดในสามสมาชิกที่ให้มา
เราจะได้รับสามสมาชิก/จำนวนเต็ม และภารกิจของเราคือเปรียบเทียบพวกเขาและหาสมาชิก/จำนวนเต็มที่น้อยที่สุดในหมู่พวกเขา
ตัวอย่าง
#include <bits/stdc++.h> using namespace std; int main() { int a = 45, b = 72, c = 10; if (a <= b && a <= c) cout << a << " is smallest" << endl; else if (b <= a && b <= c) cout << b << " is smallest" << endl; else cout << c << " is smallest" << endl; return 0; }ผลลัพธ์
10 is smallest