I am having a problem with my class and I need some help. We were assigned to make a british flag graphic without the border. I cannot use an array to create a field for the graphics because we haven't learned that yet. I must use things like gotoxy (x,y) , for, if, end, else, and goto statements, you know, elementary stuff. Supposedly this gotoxy (x,y) statement will help me solve the problem of creating one graphic line like the \ diagonal and being able to go back to the first line to start the second graphic line of the flag. What the teacher said was basically the logic will go as follows: declare the variables with the for statement, then goto the first x value (0) and when y=x, print an ASCII character. Then use the \n to go to the next line and repeat. I figure to use a 20 x 20 field to keep it simple and square. I have the following code so far and am sure some of the lines are either out of order, improperly syntaxed or not necessary.
#include<iostream.h>
#include<conio.h>
int x;
int y;
void main()
{
for(int x=0, y=0; x<20, y<20; x++, y++)
if (x==20) goto done;
gotoxy(x,y);
cout << "\x03" "\n";
done:
cin >> "";
return;
}
this is my best stab at it so far and my compiler is called Quincy 97 and is bound to be coming up with more errors than if it were running on the Borland's at School, but it is coming up with the following errors:
assignment5.cpp:12: warning: implicit declaration of function `int gotoxy(...)'
assignment5.cpp:12: warning: name lookup of `x' changed for new ANSI `for' scoping
assignment5.cpp:10: warning: using obsolete binding at `x'
assignment5.cpp:12: warning: name lookup of `y' changed for new ANSI `for' scoping
assignment5.cpp:10: warning: using obsolete binding at `y'
assignment5.cpp:16: warning: `return' with no value, in function returning non-void
Any help would be appreciated greatly.
Richard W.
#include<iostream.h>
#include<conio.h>
int x;
int y;
void main()
{
for(int x=0, y=0; x<20, y<20; x++, y++)
if (x==20) goto done;
gotoxy(x,y);
cout << "\x03" "\n";
done:
cin >> "";
return;
}
this is my best stab at it so far and my compiler is called Quincy 97 and is bound to be coming up with more errors than if it were running on the Borland's at School, but it is coming up with the following errors:
assignment5.cpp:12: warning: implicit declaration of function `int gotoxy(...)'
assignment5.cpp:12: warning: name lookup of `x' changed for new ANSI `for' scoping
assignment5.cpp:10: warning: using obsolete binding at `x'
assignment5.cpp:12: warning: name lookup of `y' changed for new ANSI `for' scoping
assignment5.cpp:10: warning: using obsolete binding at `y'
assignment5.cpp:16: warning: `return' with no value, in function returning non-void
Any help would be appreciated greatly.
Richard W.