Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b29f59b

Browse files
author
Jason
committed
feat: format
1 parent 94068c7 commit b29f59b

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

‎sorting/BubbleSort.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <iostream>
2-
#include <vector> // 👇用到了向量
3-
#include <algorithm> // 👇用到了ostream_iterator
2+
#include <vector> // 👇用到了向量
3+
#include <algorithm> // 👇用到了ostream_iterator
44
#include "./lib/DoubleVector.h" // 自定义Double型向量输入输出工具头文件
55
using namespace std;
66

‎sorting/QuickSort.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ int main()
2626
return 0;
2727
}
2828

29-
vector<double> quickSort (vector<double> vList) {
30-
if (vList.size() <= 1) return vList;
29+
vector<double> quickSort(vector<double> vList)
30+
{
31+
if (vList.size() <= 1)
32+
return vList;
3133
double pivot = vList[0]; // 取第一个元素作为参考
3234
vector<double> leftV;
3335
vector<double> rightV;
34-
for(int i = 1; i < vList.size(); i++) {
36+
for (int i = 1; i < vList.size(); i++)
37+
{
3538
cout << "for " << i << endl;
3639
if (vList[i] < pivot)
3740
// cout << "qs: " << leftV[leftV.size()] << endl;
@@ -48,4 +51,3 @@ vector<double> quickSort (vector<double> vList) {
4851
newV.insert(newV.end(), rightV.begin(), rightV.end());
4952
return newV;
5053
}
51-

‎sorting/lib/DoubleVector.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
using namespace std;
55

6-
vector<double> cinDoubleVector () {
6+
vector<double> cinDoubleVector()
7+
{
78
vector<double> vList; // 声明排序向量vList
89

910
int len; // 声明数组长度len
@@ -26,10 +27,10 @@ vector<double> cinDoubleVector () {
2627
return vList;
2728
}
2829

29-
int coutDoubleVector (vector<double> sortV) {
30+
int coutDoubleVector(vector<double> sortV)
31+
{
3032
cout << "排序后的数组为: "
3133
<< endl;
3234
copy(sortV.begin(), sortV.end(), ostream_iterator<double>(cout, "\n")); // 向量包含的元素
3335
return 0;
3436
}
35-

‎sorting/lib/DoubleVector.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ using namespace std;
77
/**
88
* 用于在命令行输入dobule型向量的元素
99
*/
10-
vector<double> cinDoubleVector();
10+
vector<double> cinDoubleVector();
1111

1212
/**
1313
* 用于在命令行输出dobule型向量的元素
1414
*/
15-
int coutDoubleVector(vector<double>);
15+
int coutDoubleVector(vector<double>);
1616

1717
#endif

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /