Skip to content

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

Closed

Conversation

NazarPolonsky
Copy link

Nazar Holickov IT-42

Nazar Holickov IT-42
@GYFK GYFK requested review from belochub and nechaido June 6, 2017 21:46
Copy link
Member

@nechaido nechaido left a 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();
Copy link
Member

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()
{
Copy link
Member

@nechaido nechaido Jun 6, 2017

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++)
{
Copy link
Member

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"
Copy link
Member

@nechaido nechaido Jun 6, 2017

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++)
Copy link
Member

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)
Copy link
Member

@nechaido nechaido Jun 6, 2017

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();
}
Copy link

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();
}
Copy link

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();
}
Copy link

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();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

cout << "There!";

_getch();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

}

_getch();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

}

_getch();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@tshemsedinov tshemsedinov changed the title Added realization on C++ Added implementation on C++ Jun 21, 2017
@tshemsedinov tshemsedinov changed the title Added implementation on C++ Added C++ implementation Jun 21, 2017
@nechaido
Copy link
Member

Closed due to inactivity.

@nechaido nechaido closed this Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants