OOP HomeWork

This commit is contained in:
e2hang
2025-08-11 00:01:30 +08:00
commit e8a5ca2363
119 changed files with 3187 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#include <iostream>
#include "sort.h"
using namespace std;
int main() {
int d, e;
cin >> d >> e;
sort_two(d, e);
int a, b, c;
cin >> a >> b >> c;
sort_three(a, b, c);
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << endl;
cout << d << e <<endl;
cout << a << b << c;
return 0;
}

View File

@@ -0,0 +1,9 @@
#include <algorithm>
void sort_two(int& a, int& b) {
if (a < b) std::swap(a, b);
}
void sort_three(int& a, int& b, int& c) {
if (a < b) std::swap(a, b);
if (a < c) std::swap(a, c);
if (b < c) std::swap(b, c);
}

7
oop_hw1/oop_hw1_6/sort.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
#ifndef sort
#define sort
void sort_three(int& a, int& b, int& c);
void sort_two(int& d, int& e);
#endif // !sort

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB