C++ 找出数组中的第二小的数 (无需函数) 日期: 2027-07-21 标签: 常规 #include using namespace std; int a[100], n; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 2; i <= n; i++) { if (a[i] < a[1]) { int t = a[1]; a[1] = a[i]; a[i] = t; } } cout << a[2]; return 0; } 原文地址: https://www.cveoy.top/t/topic/qf0y 著作权归作者所有。请勿转载和采集! 免费AI点我,无需注册和登录