mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
fix: Clean up of code examples in CONTRIBUTING to follow guidelines. (#1063)
This commit is contained in:
parent
f4fe0c6f5b
commit
4ed75018e3
@ -67,10 +67,10 @@ namespace name {
|
|||||||
/**
|
/**
|
||||||
* Class documentation
|
* Class documentation
|
||||||
*/
|
*/
|
||||||
class cls_name{
|
class class_name {
|
||||||
private:
|
private:
|
||||||
int var1; ///< short info of this variable
|
int variable; ///< short info of this variable
|
||||||
char *msg; ///< short info
|
char *message; ///< short info
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// other members also documented as below
|
// other members also documented as below
|
||||||
@ -87,15 +87,16 @@ class cls_name{
|
|||||||
template<class T>
|
template<class T>
|
||||||
bool func(int param1, T param2) {
|
bool func(int param1, T param2) {
|
||||||
// function statements here
|
// function statements here
|
||||||
if(/*something bad*/)
|
if (/*something bad*/) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Test function */
|
/** Test function */
|
||||||
void test() {
|
static void test() {
|
||||||
/* some statements */
|
/* desciptions of the following test */
|
||||||
assert(func(...) == ...); // this ensures that the algorithm works as expected
|
assert(func(...) == ...); // this ensures that the algorithm works as expected
|
||||||
|
|
||||||
// can have multiple checks
|
// can have multiple checks
|
||||||
@ -103,6 +104,7 @@ void test() {
|
|||||||
|
|
||||||
/** Main function */
|
/** Main function */
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
test(); // execute the tests
|
||||||
// code here
|
// code here
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user