OOP HomeWork
This commit is contained in:
16
oop_hw1/oop_hw1_6/main.cpp
Normal file
16
oop_hw1/oop_hw1_6/main.cpp
Normal 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;
|
||||
}
|
9
oop_hw1/oop_hw1_6/sort.cpp
Normal file
9
oop_hw1/oop_hw1_6/sort.cpp
Normal 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
7
oop_hw1/oop_hw1_6/sort.h
Normal 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
|
BIN
oop_hw1/oop_hw1_6/测试截图1_6.jpg
Normal file
BIN
oop_hw1/oop_hw1_6/测试截图1_6.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 220 KiB |
Reference in New Issue
Block a user