1 Attachment(s)
Problem with coding from a beginner
I am having problems with my code. At first it was going fine until I went ahead and added more bitmaps and finished my code. First, it displayed the error message and also the last bitmap. I then tried else but it claims that I am missing an if but they are there. What did I do wrong?
Re: Problem with coding from a beginner
Quote:
Originally Posted by
deathmankid
I am having problems with my code. At first it was going fine until I went ahead and added more bitmaps and finished my code. First, it displayed the error message and also the last bitmap. I then tried else but it claims that I am missing an if but they are there. What did I do wrong?
You have ";" after "if" statements. Remove them.
Re: Problem with coding from a beginner
Quote:
Originally Posted by
VladimirF
You have ";" after "if" statements. Remove them.
I removed them, but else is still "illegal."
Re: Problem with coding from a beginner
Quote:
Originally Posted by
deathmankid
I removed them, but else is still "illegal."
You must have missed one or two. Without your code I can only guess...
Re: Problem with coding from a beginner
Furthermore you confused operator "==" with "=".
Do you know the difference?
And another suggestion:
Many "else if" statements can be written more elegant in a switch statement (but don't forget the "break"'s).
With friendly regards
Programartist
Re: Problem with coding from a beginner
You have extra braces. Your code
Code:
if (x == 1);
{
dbLoadBitmap("RomanNumber1.bmp",0);
}
else
{
if (x = 2);
{
dbLoadBitmap("RomanNumber2.bmp",2);
}
else
{
if (x = 3);
{
dbLoadBitmap ("RomanNumber3.bmp",3);
}
else
{
Lose all the ones in red, and the rest like that.