Hi all.
I need some exercises for my students tonight to keep them busy. We've already gone through the student guide.
they only know how to do if statements, arrays... you know, the basic stuff.
P.S They are doing QBasic
Printable View
Hi all.
I need some exercises for my students tonight to keep them busy. We've already gone through the student guide.
they only know how to do if statements, arrays... you know, the basic stuff.
P.S They are doing QBasic
Have them write the old palendrom program
like have it input a word and then checks to see if that word is a palindrom
Get them to make some sort of one-way encription algorithm. Then get them to give me the code of the one that works best :) All I can think of is using negative roots (imaginary numbers) with the letters :)
Sort an array.
Hey, on that password encryption thing, I just went and tried it, but it wont let me call the sqrt() function on a negative (imaginary) number. BUT I can raise it to the power of a half, ie:
CurrentLetter = CurrentLetter * (-8^(1/2));
But I'm not sure if the above is doing what it should be doing. Anyone know why?
Remember that my students are beginners, not rocket scientists like us...
I think sorting algorithms are good to teach beginners. Radix is one of the most valuable things I learned in a programming class. Fastest sort out there.
How bout implement a string compare or a string search. Or, given a string, count the number of occurences of the letter 's'. Or, given a string, do a frequency table for all of the letters (I like that one. It can lead to a huffman compression:) although, huffman may be too much for them at the moment.
>>CurrentLetter = CurrentLetter * (-8^(1/2));
Because ^ is XOR. Use pow( ).
Quote:
Originally posted by XSquared
>>CurrentLetter = CurrentLetter * (-8^(1/2));
Because ^ is XOR. Use pow( ).
Quote:
P.S They are doing QBasic
QBasic doesn't have a ; at the end of the line, so I assumed that it was C.
Ops, my bad, yes he's right it was C, I know the thread was for QBasic but I was just trying it in C (I don't know QBasic).
Lol I was doing that in some code I was writing and couldn't figure out why it wasn't giving the right output...Took me like half an hour to remember the ^ isnt a power operator...:o