How are you doing as far as understanding the killing clowns example? —hartnell
Well, actually. I added a couple of line just experimenting:
#include <stdio.h>
int main()
{
int clowns;
int kill_clowns;
clowns = 10;
kill_clowns = 0;
while (clowns > 0)
{
printf ( "%d clowns are coming to get you\n", clowns );
if (clowns > 0)
{
printf ( "Kill how many clowns? " );
scanf ( "%d", &kill_clowns );
clowns = clowns - kill_clowns;
if ( clowns < 0 )
{
clowns = 0;
}
if (clowns == 0)
{
printf ("You have killed all of the clowns\n");
printf ("(press enter)");
getchar();
}
getchar();
}
}
return 0;
}That's what I originally tried to do, but getchar() doesn't work for me like it's supposed to. So you understand how all that code works? —hartnell
Yes I do (thanks to you) I think that your tutoring cleared up alot of my learning block!!!! I cant wait to see what im gonna learn tonight! What about assignments? Are there any exercises you you want me to complete for good practice?
I can't think of any and honestly I'm focused on writing a FB tut right now so I can't tell you what we'll cover tonight. But, I can tell you it will come directly out of my C book, like last night. (well, the code principles, if not killing clowns.)
I *should* have the code on the wiki by the time class starts tonight. —hartnell
Is there a specific reason you picked BASIC over C? The reason why I'm asking, is because the only reason why I chose C is because I thought that more can be done with C than with any other language? Can BASIC accomplish everything that C can?
I'm sorry, I just made the assumption that you had chosen it as preffered, my bad. In your opinion whats a good language (programming) to learn that would be high level enough to learn to where I would only have to learn one language and not have to learn another to progress further in my programming "career"? In other words if you could only learn one language, and have to stick with that particular language….what would it be? Also along the same lines, if I were to switch from C to FreeBASIC would I be making any sacrifices?
Consider This :
// c-syntax
if (var == 0) {
printf ( "Var = 0!!");
}' basic syntax
if var = 0 then
print "Var = 0!!"
end ifWhen you get down to it, once you've learned core programming, you've learned core programming for 99% of all programming languages. Just the syntax is a bit different.
About "switching" from C to FreeBASIC. I can only see advantages for you (if you can find a linux FB IDE). It's easier to learn and you'll make faster progress with it. But don't get into the "I'm going to use one, and only one programming language my entire life." That just doesn't happen. :)
—hartnell
Dim clowns As Integer
Dim kill_clowns As Integer
clowns = 10
kill_clowns = 0
while clowns > 0
print clowns ; " clowns are coming to get you."
if clowns > 0 then
print "Kill how many clowns?"
input kill_clowns
clowns = clowns - kill_clowns
if clowns < 0 then
clowns = 0
end if
if clowns = 0 then
print "You have killed all of the clowns."
print "(press enter)"
sleep
end if
end if
sleep
wend
endI haven't tested this, but this is what kill clowns would look like in FB.
—hartnell





