Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
98266 王子毅 比较三个数大小II C++ Accepted 0 MS 268 KB 557 2024-11-17 17:19:13

Tests(1/1):


Code:

#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int nums[3] = {a, b, c}; // 使用冒泡排序对三个数进行排序 for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2 - i; ++j) { if (nums[j] > nums[j + 1]) { int temp = nums[j]; nums[j] = nums[j + 1]; nums[j + 1] = temp; } } } for (int num : nums) { cout << num << " "; } cout << endl; return 0; }