-
-
Notifications
You must be signed in to change notification settings - Fork 120
Added C++ implementation #6
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
Conversation
Nazar Holickov IT-42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment to the first file apply to every one of them. You should not use compiler specific features. Also this PR must include examples of std
features like std::iterator
and std::for_each
.
{ | ||
cout << i << endl; | ||
} | ||
_getch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like the idea to use _geth()
in here, if you think it is vital to get user input before ending the program - you could write an example runner.
using namespace std; | ||
|
||
void For() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to use Google C++ Style Guide, so the brace should stay on the same line.
void For() | ||
{ | ||
for (int i = 0; i < 10; i++) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@@ -0,0 +1,14 @@ | |||
#include "stdafx.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is really needed? I see no reason for this file to include "stdafx.h"
. Moreover it isn't even committed.
|
||
void For() | ||
{ | ||
for (int i = 0; i < 10; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation must be made with 2 spaces not tabs.
{ | ||
int arr[] = { 4, 2, 7, 8, 1, 6, 9, 5 }; | ||
int index = 0; | ||
for each (int item in arr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is Visual C++ only. Moreover it is deprecated.
Iterates through an array or collection. This non-standard keyword is available in both C++/CLI and native C++ projects. However, its use is not recommended. Consider using a standard Range-based for Statement (C++) instead.
You should have used
for (auto item : arr)
cout << i << endl; | ||
} | ||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at the end of file.
cout << index++ << endl; | ||
} | ||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at the end of file.
} while (index < 10); | ||
|
||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at the end of file.
} | ||
|
||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
cout << "There!"; | ||
|
||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
} | ||
|
||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
} | ||
|
||
_getch(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Closed due to inactivity. |
Nazar Holickov IT-42