hello cruel world

Postby mark krebs on Sun Nov 27, 2005 9:46 pm

Here's a simple program. Tests your division tables.
I've been building it on PC & uploading it.
Prints hash to the screen ~20% of the time...

// Divide Test
@cid "Divd";
@name "Divide";
@dbname "DivideDB";
@ver "1.4";

main() {
int answer,a,b,w[4],correct;
alert("Hello, Kiddies!");

while(true){
a=random(13);
b=random(12)+1;
w[0]=random(13);
w[1]=random(13);
w[2]=random(13);
w[3]=random(13);
correct = random(4); // the place we'll put the answer.
answer = -1; // ensure one pass through loop.
w[correct]=a; // hide it here.

while (answer != correct){
answer=alertc("divide test",("Question: " + (a*b) + "/" + b + "= ?"),
w[0] + ":" + w[1] + ":" + w[2] + ":" + w[3],1);
if(answer==correct)
alert("Good job!");
else
alert("Nope.");
}
}
}

-mark
-mark
mark krebs
 
Posts: 3
Joined: Sun Nov 27, 2005 11:03 am

Postby mark krebs on Mon Nov 28, 2005 12:53 am

Fixed my problem by introducing an intermediate string variable, to contain the long concatenation of the Question and it's parameters.
don't know why this didn't work with the same text inside the alert call.



-mark
-mark
mark krebs
 
Posts: 3
Joined: Sun Nov 27, 2005 11:03 am


Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 1 guest

cron