Home > Palm > Samples > Combination > PocketC
  Palm sample in PocketC


This is the PocketC version of our combination application. It's one of the Palm Samples.


You need PocketC (see tools section).

 Source code

Below is the .c file. For .bmp and .prc, please download the ZIP file.

// Combination.c
// Palm
// PocketC

@cid "CoPC";
@ver "1.0";
@name "Comb-PC";
@dbname "CoPC";
@licon1 "large.bmp";
@sicon1 "small.bmp";

int Factorial(int n)
  if (n <= 1)
     return 1;
     else return n*Factorial(n-1);

int Combination(int n, int p)
    return Factorial(n)/(Factorial(n - p) * Factorial(p));

    int n = 0, p = 0;
    char buf[10];
    puts("Combination > Palm > PocketC\n\n");
    n = gets("Value for 'n': ");
    p = gets("Value for 'p': ");
    puts("Factorial(" +n +") = " +Factorial(n) +"\n");
    puts("Factorial(" +p +") = " +Factorial(p) +"\n");
    puts("Factorial(" +(n-p) +") = " +Factorial(n-p) +"\n");
    puts("Combination(" +n +"," +p +") = " +Combination(n,p) +"\n");


PocketC is a very valuable tool. They offer both a mobile and a desktop version of their product, not only for Palm but also for Pocket PC.

You have probably noticed that this version is sensibly shorter than the C version with Palm SDK. Also, PocketC doesn't need an extra file to describe the resources it uses. Those guys are declared at the beginning of the .c file, in the lines starting with @.

The core functions are located at the beginning of the .c file: Factorial(), Combination() and main(). Again, note that there is hardly any overhead, compared with the Palm SDK version.

Next sample

[ Copyright © 2000- Eric Poncet - All rights reserved ]

[ Stage de musique classique | Stage de musique baroque | Stage de musique de chambre | Stage de musique latine ]
[ Stage de jazz | Stage de musiques actuelles | Stage de funk | Stage de metal | Stage de pop | Stage de reggae | Stage de rock ]
[ Stage d'improvisation | Colonie musicale ]