Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Singleton/C/singleton-1.c
Normal file
7
Task/Singleton/C/singleton-1.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef SILLY_H
|
||||
#define SILLY_H
|
||||
|
||||
extern void JumpOverTheDog( int numberOfTimes);
|
||||
extern int PlayFetchWithDog( float weightOfStick);
|
||||
|
||||
#endif
|
||||
25
Task/Singleton/C/singleton-2.c
Normal file
25
Task/Singleton/C/singleton-2.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
...
|
||||
#include "silly.h"
|
||||
|
||||
struct sDog {
|
||||
float max_stick_weight;
|
||||
int isTired;
|
||||
int isAnnoyed;
|
||||
};
|
||||
|
||||
static struct sDog lazyDog = { 4.0, 0,0 };
|
||||
|
||||
/* define functions used by the functions in header as static */
|
||||
static int RunToStick( )
|
||||
{...
|
||||
}
|
||||
/* define functions declared in the header file. */
|
||||
|
||||
void JumpOverTheDog(int numberOfTimes)
|
||||
{ ...
|
||||
lazyDog.isAnnoyed = TRUE;
|
||||
}
|
||||
int PlayFetchWithDog( float weightOfStick )
|
||||
{ ...
|
||||
if(weightOfStick < lazyDog.max_stick_weight){...
|
||||
}
|
||||
7
Task/Singleton/C/singleton-3.c
Normal file
7
Task/Singleton/C/singleton-3.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
...
|
||||
#include "silly.h"
|
||||
...
|
||||
/* code using the dog methods */
|
||||
JumpOverTheDog( 4);
|
||||
retrieved = PlayFetchWithDog( 3.1);
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue