Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int
avarage1 ( int x, int y )
{
int somme = 0;
while ( x == y )
{
x*=y;
@Silberbogen
Silberbogen / gist:4ef3ba6ec1455cc12e8e
Created February 16, 2015 01:40
PKGBUILD sbcl 1.2.8
# $Id$
# Contributor: John Proctor <jproctor@prium.net>
# Contributor: Daniel White <daniel@whitehouse.id.au>
# Maintainer: Juergen Hoetzel <juergen@archlinux.org>
# Contributor: Leslie Polzer (skypher)
# Contributo: Sascha K. Biermanns <skbierm at yahoo dot de>
pkgname=sbcl
pkgver=1.2.8
pkgrel=1
;;; ==========================
;;; Spiele - wir lieben Spiele
;;; ==========================
(defun hole-zahl (string)
"(hole-zahl string)
HOLE-ZAHL gibt die Zeichenkette String aus und erzwingt die Eingabe einer Zahl."
(format t "~A" string)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
int main (int argc, char *argv[]) {
if (argc == 1) {
printf("usage: %s <directory>\n", argv[0]);
exit(EXIT_SUCCESS);
}
// This was a task from a programming learn book
// You'll have to crack a code. You must enter for every character from A to H
// and from a to h a number. To get the real numbers you know the following:
// 1. Aa, Bb, Cc, Dd, Ee, Ff, Gg and Hh are prime numbers.
// 2. ABC is a multiple of Aa.
// 3. abc is equal to cba.
// 4. CDE is the product of Cc times the checksum of CDE.
// 5. Bb is equal to the checksum of cde.
// 6. EFG is a multiple of Aa.
// 7. efg is the product of Aa times the checksum of efg.
@Silberbogen
Silberbogen / swap.c
Created December 2, 2012 22:09
A generic swap function + Macro for C
// Macro for using the swap-function
#define SWAP(a,b) swap(&(a),&(b),sizeof(a))
// swap - a generic swap-algorithmus
void swap(void *va /* vektor object a */,
void *vb /* vektor object b */,
size_t i /* length of the objects */ )
{
uint8_t temp; // address for buffering one byte
uint8_t * a = va; // bytewise moving pointer to va
@Silberbogen
Silberbogen / wordsquare.c
Created December 2, 2012 20:18
Another C program for printing a wordsquare
// Another C program for printing a word square
// compile via c99 -o wordsquare wordsquare.c
#include <stdio.h> // for printf
#include <stdlib.h> // for getenv, atoi, abs
#include <stdbool.h> // for bool, true, false
#include <string.h> // strlen
// --------------------------------------------------------------------------
// Declaration: solution_square
@Silberbogen
Silberbogen / star.c
Created November 18, 2012 19:57
another C program for printing a star pyramid
// another C program for printing a star pyramid
// You can start it via setting the number of rows
// via a environment variable like
// export rows=19
// otherwise the program will ask you for a number
// of rows
// compile via c99 -o star star.c
#include <stdio.h> // for printf
#include <stdlib.h> // for getenv, atoi
@Silberbogen
Silberbogen / modern_c_a4.10.c
Created November 13, 2012 09:41
Eine moderne Lösung der Aufgabe 4.10 aus dem Buch C/C++
# include <stdio.h>
# include <stdlib.h>
int main()
{
// Aa, Bb, Cc, Dd, Ee, Ff, Gg, Hh sind Primzahlen
// jedoch ergibt sich aufgrund der Aufgabenstellung, das keine der Variablen die Ziffer 0 repräsentieren
// kann, daher ergibt sich ein Feld aus den folgenden Primzahlen:
const int primzahl[] = { 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
// Ersatzweise hätte diese Liste auch mit Hilfe des Sieb des Erasthostenes erstellt werden können.
const int primzahlen = sizeof primzahl;
@Silberbogen
Silberbogen / exchange.c
Created September 30, 2012 20:41
a short function for removing unwanted characters
// This file is compileable with a C99 or C11 compatible compiler
// use: gcc with parameters -std=c99 or -std=c11
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
// routine: is_unwanted
// task: checks if a character is one of the list of unwanted characters
// -----------------------------------------------------------------------