You are on page 1of 14

Introduction to the QUINCY C/C++ Programming

Aim: To learn how to use the QUINCY Programming environment to write a C
program, compile and link it, execute the program, and make use of the Single Step
and breakpoint features.
QUINCY is an Integrate Development Environment (IDE) which integrates a C/C++
compiler, linker, an Editor, and debug features into a common windows program. It
can be used to develop C/C++ programs to run in a "DOS" style window. It can also
be used to develop a C/C++ windows program. QUINCY is a freeware program that
can be down loaded from the web site The software
will run on Windows 9x, Windows Millennium, Windows NT, and Windows XP.
To start QUINCY, position the mouse cursor over the QUINCY icon (White Cat!) and
double click the mouse left button. You may have to navigate through the start ->
Programs -> QUINCY menu if the QUINCY icon is not on the desktop.
Once you have started QUINCY you should see a screen similar to the one shown

The program follows the usual Windows program format.

We will start by using the in built editor to write a short C program to calculate the
average of 5 numbers entered at the keyboard.
Click on the drop down menu item File and select New C++ Source File.

The above window will open. Click on OK and this window will close.
You should now see a new edit window as shown below.

You are now going to type in the following program in this edit window.
Copy the program carefully into the edit window, taking care to enter the program
exactly as it is printed.

The Average Program:

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
char q;
int k;
float number, sum, ave;
printf("Please enter a Number");
printf("Average is:%10.2f\n",ave);
Once you have typed the program into the edit window you need to save it in a file for
later retrieval. Note that the compiler will only be able to compile a program that has
been saved to a named file. The program is to be called average.c Note the .c at the
end of the name, this is very important.
To save the file use the File drop down menu item and select "save as".
Navigate the QUINCY folder. And select the programs folder.

Here you can click on the "New Folder button (third button from the Quincy2002 edit

A new folder will appear. Call it "my programs".

Enter this new folder and save your average.c program.

Now you are ready to start to compile your program.
Go to the Project drop down menu item and select the Build item.
The Build window will open and you will see Quincy building your program.

If all is well you will see the Successful build text. If not there will be some
information indicating errors, with the all important line number of the statement
containing the error. When you have a successful build, close down the Build
Now to run the program, click on the Project drop-down window again and select the
Execute item.

The "DOS style" run window will open as illustrated above. Now you can enter the
numbers as invited by the program.

Note that when you finish your program Quincy will print out a Press Enter to return
to Quincy. This is to allow you to see your program output.
Now you have completed your first C program e need to look at how your can check
your program a single instruction at a time.
To single step through your program you need to enter the Debug drop down menu
and select the Step item (or press F7).

As you can see in the above screen shot this introduces a green arrow to the left of the
program, pointing at the first instruction to be executed. Note that at this point the
instruction has not yet been executed. You can use F7 to step through the program.

If you look on the Windows Task bar (not shown in the above screenshot) you will see
an MSDOS icon with your program name (average). Click on this and you will see a
DOS window. This is your programs output window.
If you single step through the program up to the scanf(..) instruction, then step over
this instruction (to execute it), then click on the MSDOS icon in the task bar you will
see your program output with the first message.

Enter the first number into the MSDOS output screen and press enter.
The program will step on and the DOS output window will disappear back onto the
task bar. This is a common feature of the DOS output window. It will not stay on the
screen all of the time, only when you evoke it.
Continue to step through the program. It will keep looping back to the scanf(..)
statement, and when you execute this statement (with the F7 key) you can evoke the
DOS window to enter the next value.
In due course the program will terminate and the DOS output window will disappear.
Note that you can terminate the program at any time by simply clicking on the Stop
Icon (red seven sided Stop button at the top of the QUINCY Window). At this point a
Window will open inviting you to end the debug session.
Using watch window to see what is happening to your program variables.
The variables in our program (q, k, number, sum, and ave) are changing as your
program is being executed. It is useful to be able to follow those changes as you step
through the program. This is where the watch window comes in handy.

Click on the Debug drop down menu item and select Watch.

Enter the k variable name into the Variable text bar of the Add Watch window and
click on OK.

The k variable now appears in the watch window (no value yet since we have not
started to run the program.
Enter variable number, sum, and ave in a similar manner. As you can see from the
buttons available in the Watch Window, you can add and delete variables to and from
the Watch Window.
Now that you have entered all of the variables we wish to watch you can now start to
single step through the program with F7. Note that you will need to click on the edit
window before QUINCY will respond. This is important so I will say it again!
when you evoke the DOS output screen you need to click on the QUINCY edit
screen before you can execute the next instruction with the F7 key.

You will notice that when you first start to single step through the program the
variables will appear to have odd values. This is quite normal since the variable will
Contain random values.

The above screenshot shows the program after it has executed 2 loops of the program.
Complete the execution of the program. Remember when you evoke the DOS output
screen you need to click on the QUINCY edit screen before you can execute the next
instruction with the F7 key.
Break Points: Often you will want to execute your program at full speed up to a
particular point, then single step from there. This is particularly so in a large program
where it might take quite a long time to single step through the program. Also, a lot
of programs will contain program loops (like the "for loop" in the average.c program)
that execute around to loop a large number of times. You might want to execute the
program at full speed until the program loop is complete, the single step from there.
This is where the Break Point comes in handy.
To set up a break point place the cursor at the instruction you want to set a break
point, then click on the Debug drop down menu item and chose "Breakpoints" (F2
does the same thing).

As you can see from the above screen shot a hand icon is placed at the point in the
program where the break point has been set.
Now start the program using Project -> Execute and the program will execute as a
normal run, allowing you to enter the values as prompted by the program. When all
values have been entered, the program will halt at the breakpoint (set up outside of the
program loop).
Most of this program activity takes place inside of the "for loop". The average value
is calculated outside of the loop.

Notice that the Green arrow is now over the hand icon indicating that the program has
now reached the break point. At this point your can single step through the remainder
of the program.
Try setting up your own break points in the program.
The Evaluate variable is anther useful feature of the debug tools. This can be used to
change the value of a variable in your program at any point in its execution.
Sometimes you want to override a value that has been calculated in the program. For
example, you might want to override the k value used in the "for loop" to make the
program leave the "for loop" before it normally would. Actually this is not a very
good example sine in out program it would result in a wrong average answer, but the
idea is sound. In our program we could just change the value of a variable we have
just entered at the keyboard (using the scanf(..) instruction. This is a typical use (we
might have just typed in the wrong values by mistake).
To use the "evaluate" feature click on debug, then evaluate.
Enter the variable name in the Expression text box (you could enter the variable
number here). Then in the Change text box, the new value (say 5). Now click on OK
and your evaluate window should look like the one below.

Now then you continue to execute the program the new value for number (5) will be
Try changing a few other variables in the program to get some practice.
We have now completed the basic tutorial on how to use QUINCY C IDE.
To learn more about QUINCY look at the help window. This will open up the PC's
Browser and you can browse through the hypertext based help information. A lot of it
is what we have just done in this tutorial, but there is more they're as well.
In particular look at the help information on Creating Projects, and stepping over C
functions. You will need to know about these later on.
Exercise: A program with mistakes.
Finally, try entering the following C program. It has a number of mistakes in it. You
can learn a lot about the error messages produced by the QUINCY compiler by going
through this exercise. As you can see its the same average program but with
mistakes. This makes it possible for you to correct the mistakes after you have had a
chance to see the error messages produced by the compiler.
In particular, note the line numbers given by the compiler.

#include <stdio.h>
#include <conio.h>
#included <stdlib.h>
cha q;
integer k;
float number, sum, ave;
printf(Please enter a Number);
printf("Average is:%10.2f\n",ave);
Note that as you correct each error re-compile with build so you can see the effect.
You might find that as some of the errors disappear, new ones appear.