I’m aware that this conversation is almost two years old, but you may (or, more likely, may not ;) be interested to know that almost two months ago I posted to my blog my solution to the “Lucky Name Numbers” problem posed by WJEC for the GCSE Computer Science unit 3 (“Developing Computing Solutions”) controlled assessment, although I focussed more on writing about- than on programming- my solution as I’ve a lot more experience of the latter than of the former – I’ve solved problems posed by the Advent Programming Contest, and Contest Coding, and …
This file contains 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
public class RussianPeasantMultiplication | |
{ | |
public static int multiply( int l, int r ) | |
{ | |
int result = 0, lsb = l & 1; | |
if( lsb == 1 ) | |
result += r; | |
while( l != 0 ) | |
{ | |
r <<= 1; |
This file contains 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
#include <SDL2/SDL.h> | |
#include "seal_quadColours_triangles.h" | |
#include "seal_texture.h" | |
int main( const int argc, const char * const argv[] ) | |
{ | |
const int W = 320, H = 240; | |
SDL_Init( SDL_INIT_VIDEO ); | |
/* Request a stencil buffer of at least 1bit per pixel. */ |
This file contains 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
#include "printDateAndTime.h" | |
#include <time.h> | |
#include <stdio.h> | |
void p_PrintDateAndTime( void ) | |
{ | |
time_t t_0; | |
struct tm *t_1; | |
char s[ 26 ]; | |
time( &t_0 ); |
This file contains 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
#include "bigBooleanArray.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
static long g_maximum_index; | |
static long g_number_of_bytes; | |
static char *g_byte = NULL; | |
bool f_BigBooleanArray_Initialised( void ) | |
{ |
This file contains 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
This program will enumerate the format command characters in the file 'metal_help.mhlp', viz. characters preceded by three '@' characters. | |
'T' | |
'C' | |
'L' | |
'N' | |
't' | |
'B' | |
'n' | |
'I' |
This file contains 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
{$R+} | |
unit formatCommandCharacterList; | |
interface | |
const | |
k_HEADER = 1; {T} | |
k_CENTERED_PARAGRAPH = 2; {C} | |
k_LINK = 3; {L} | |
k_HORIZONTAL_RULE = 4; {E} |
This file contains 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
#include <SDL2/SDL.h> | |
#include "seal_quadColours_triangles.h" | |
#include "seal_texture.h" | |
int main( const int argc, const char * const argv[] ) | |
{ | |
const int W = 320, H = 240; | |
SDL_Init( SDL_INIT_VIDEO ); | |
SDL_Window *window = SDL_CreateWindow( "SDL2 & OpenGL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, W, H, SDL_WINDOW_OPENGL ); |