Skip to content

Finish the Algorithm part #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e1aa3a3
Update
Jul 3, 2019
1b3537e
Update README.md
Jul 3, 2019
037b2b6
Update the markdown file
Jul 3, 2019
b4b9a54
Update the Notebook with Code Example
Jul 3, 2019
9cc09a7
Update the Notes
Jul 7, 2019
daf6548
Slightly Change
Jul 7, 2019
9d0cd64
Update istream_iterator.cpp
Jul 8, 2019
8864a6d
Update the quiz answer
Jul 9, 2019
4b80f50
Update 热血格斗场.cpp
Jul 10, 2019
ab6f91a
Update notes
Jul 12, 2019
4f81240
Update the notes
Jul 15, 2019
aad5a6d
Adding Notes
Jul 16, 2019
4c4353c
Add more code example
Aug 15, 2019
fdacc8e
cheeseBoard_game
Aug 19, 2019
0a728a4
fix the bugs
Aug 19, 2019
78ffae8
homework
Aug 21, 2019
507e127
add gitignore
Aug 21, 2019
fe9dd75
delete the .o file
Aug 21, 2019
2e1fb76
fix bugs
Aug 21, 2019
76301c6
dynamic programming
Sep 22, 2019
99777f1
dynamic programm
Sep 23, 2019
a853a1c
Jimmy Jump
Sep 23, 2019
e5102fb
debug Jimmy Jump
Sep 23, 2019
9e8e30d
finish week4
Sep 24, 2019
7dacdd5
add DP notes
Oct 6, 2019
dfc81a0
BoxGame of DP
Oct 6, 2019
0625fd9
finish Dynamic Programming homework
Oct 6, 2019
78c6a0c
clean the picture
Oct 6, 2019
4670b08
Deep First Search Part1
Oct 14, 2019
7e10d08
Update Image Addresss
Oct 14, 2019
aad3cf5
add sudoku for dfs
Oct 16, 2019
03cd0ae
birthdayCake for pruning DFS
Oct 20, 2019
e55f635
hw for dfs
Oct 22, 2019
40a3827
BFS with example
Oct 27, 2019
b95498a
BFS Assignment
Oct 27, 2019
8458267
BfS
Oct 30, 2019
9d5d895
add example catchCow for BFS
Oct 31, 2019
048dfc7
fixed bug in c++98
Nov 1, 2019
59cf93a
BFS finished
Nov 2, 2019
df15d23
finish week9 hw
Nov 17, 2019
419dafb
acvoid commit the vs-code file
Nov 17, 2019
eeeb270
finish week10
Dec 8, 2019
4437a0b
add note for c++11
Mar 2, 2020
1abf6e8
Merge branch 'master' of https://github.com/AnfangRobkit/programming-…
Mar 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.o
*/build/
**/build
*.json
*/.vscode
*/.vscode/
*/pic/
*.jpg
*.png
*/.vs
*/.vs/
.idea/
64 changes: 42 additions & 22 deletions 3.C++程序设计/week10(final)/计算数组的低3位之和.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
#include <cstring>
#include <cstdlib>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

// �ڴ˴�������Ĵ���
struct CMy_add
int CompareString(const void * e1, const void * e2)
{
int &sum;
CMy_add(int &s) :sum(s) {}
void operator()(int val)
{
sum += (val & 7);
}
};

int main(int argc, char* argv[])
MyString * s1 = (MyString *)e1;
MyString * s2 = (MyString *)e2;
if (*s1 < *s2)
return -1;
else if (*s1 == *s2)
return 0;
else if (*s1 > *s2)
return 1;
}
int main()
{
int v, my_sum = 0;
vector<int> vec;
cin >> v;
while (v) {
vec.push_back(v);
cin >> v;
}
for_each(vec.begin(), vec.end(), CMy_add(my_sum));
cout << my_sum << endl;
MyString s1("abcd-"), s2, s3("efgh-"), s4(s1);
MyString SArray[4] = { "big","me","about","take" };
cout << "1. " << s1 << s2 << s3 << s4 << endl;
s4 = s3;
s3 = s1 + s3;
cout << "2. " << s1 << endl;
cout << "3. " << s2 << endl;
cout << "4. " << s3 << endl;
cout << "5. " << s4 << endl;
cout << "6. " << s1[2] << endl;
s2 = s1;
s1 = "ijkl-";
s1[2] = 'A';
cout << "7. " << s2 << endl;
cout << "8. " << s1 << endl;
s1 += "mnop";
cout << "9. " << s1 << endl;
s4 = "qrst-" + s2;
cout << "10. " << s4 << endl;
s1 = s2 + s4 + " uvw " + "xyz";
cout << "11. " << s1 << endl;
qsort(SArray, 4, sizeof(MyString), CompareString);
for (int i = 0; i < 4; i++)
cout << SArray[i] << endl;
//s1�Ĵ��±�0��ʼ����Ϊ4���Ӵ�
cout << s1(0, 4) << endl;
//s1�Ĵ��±�5��ʼ����Ϊ10���Ӵ�
cout << s1(5, 10) << endl;
return 0;
}
Loading