duckfeet image courtesy Paul Filmer.  Paul Filmer Rules.
Change your x,y values so that your output looks like the solution.

Click here to see the source for this exercise.  If that link shows different source than what you have, then you have an older version of FeetWetCoding and you should download the new version(Or else the "Click here" link is wrong, if so please let me know at our Forum.)

In this exercise, you will learn:
  • What "x,y coordinate" means.
  • How to change both the x and y coordinates, to give you some experience judging where things are in the drawing area using the fwcDrawText() function.
Why you need to know this:
  • Since x,y parameters are so important, and you will be using them constantly, it is good to get a little more practice with using them.
  • You will be using fwcDrawText() throughout your work in fwc, so you need to be comfortable with it.
To do this exercise you need to know:

    Change both the x and y parameters.

    Throughout fwc, we will talk about coordinates on the screen.  A coordinate is the x location and y location, separated by a comma like this: 250,300.  That coordinate refers to the location on the screen where x=250 and y=300.  That is what we mean when we talk about "x,y" coordinates.

    This exercise is similar to the last two, except that now you are changing both the horizontal and vertical position.  Go ahead and see if you can change the x and y values to make the exercise visually match the solution.  In this case, the x value (the second parameter, after the text string parameter) is 250 and the y value is 300, the third parameter.  Remember to close the fwc window before you try to run your program again in Qt Creator.

    Notice that changing the x and y parameters is what changes the location on the screen.  The numbers in the first parameter "250,300"  (which is not a number, but a string of characters) are just the text that you display, and do not control where on the screen something gets drawn.  Your program will happily draw "250,300" at the x,y coordinates 99,101 if you only change the x and y parameters, but leave the first parameter, the text string, as "250,300".

    If you want to draw a number on the screen (instead of the text string for a number, such as "250") you will need to use a different function that we provide, called fwcDrawInt() which we will get to in a few exercises.

    If you get stuck, check the hint link below.  When you are done working on this exercise, remember to check the solution code, which lives one directory below your exercise code in the "Solutions" directory, and is in this file:

    exercises/C01-Beginner_Exercises/S01-fwcTools1/Solutions/ 040_ChangeXYParametersSOLN.cpp

    Always understand the SOLN code before you proceed to the next exercise!

    When you are ready, you can proceed to 050_ChangeColorParameter.cpp.