-
Notifications
You must be signed in to change notification settings - Fork 63
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
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
e1aa3a3
Update
1b3537e
Update README.md
037b2b6
Update the markdown file
b4b9a54
Update the Notebook with Code Example
9cc09a7
Update the Notes
daf6548
Slightly Change
9d0cd64
Update istream_iterator.cpp
8864a6d
Update the quiz answer
4b80f50
Update 热血格斗场.cpp
ab6f91a
Update notes
4f81240
Update the notes
aad5a6d
Adding Notes
4c4353c
Add more code example
fdacc8e
cheeseBoard_game
0a728a4
fix the bugs
78ffae8
homework
507e127
add gitignore
fe9dd75
delete the .o file
2e1fb76
fix bugs
76301c6
dynamic programming
99777f1
dynamic programm
a853a1c
Jimmy Jump
e5102fb
debug Jimmy Jump
9e8e30d
finish week4
7dacdd5
add DP notes
dfc81a0
BoxGame of DP
0625fd9
finish Dynamic Programming homework
78c6a0c
clean the picture
4670b08
Deep First Search Part1
7e10d08
Update Image Addresss
aad3cf5
add sudoku for dfs
03cd0ae
birthdayCake for pruning DFS
e55f635
hw for dfs
40a3827
BFS with example
b95498a
BFS Assignment
8458267
BfS
9d5d895
add example catchCow for BFS
048dfc7
fixed bug in c++98
59cf93a
BFS finished
df15d23
finish week9 hw
419dafb
acvoid commit the vs-code file
eeeb270
finish week10
4437a0b
add note for c++11
1abf6e8
Merge branch 'master' of https://github.com/AnfangRobkit/programming-...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ∑ | ||
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; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.