You are on page 1of 14

Introduction to the QUINCY C/C++ Programming

Environment
Aim: To learn how to use the QUINCY Programming environment to write a C
program, compile and lin it, e!ecute the program, and mae use o" the #ingle #tep
and $reapoint "eatures%
Introduction:
QUINCY is an Integrate &evelopment Environment 'I&E( which integrates a C/C++
compiler, liner, an Editor, and de$ug "eatures into a common windows program% It
can $e used to develop C/C++ programs to run in a )&*#) st+le window% It can also
$e used to develop a C/C++ windows program% QUINCY is a "reeware program that
can $e down loaded "rom the we$ site www%alstevens%com/,uinc+%html% The so"tware
will run on -indows .!, -indows /illennium, -indows NT, and -indows 0P%
To start QUINCY, position the mouse cursor over the QUINCY icon '-hite Cat1(
and dou$le clic the mouse le"t $utton% You ma+ have to navigate through the start 23
Programs 23 QUINCY menu i" the QUINCY icon is not on the destop%
*nce +ou have started QUINCY +ou should see a screen similar to the one shown
$elow%
The program "ollows the usual -indows program "ormat%
-e will start $+ using the in $uilt editor to write a short C program to calculate the
average o" 4 num$ers entered at the e+$oard%
TASK 1: CREATING A NEW C PROGRAM
Clic on the drop down menu item 5ile and select New C++ #ource 5ile%
The a$ove window will open% Clic on *6 and this window will close%
You should now see a new edit window as shown $elow%
You are now going to t+pe in the "ollowing program in this edit window%
Cop+ the program care"ull+ into the edit window, taing care to enter the program
e!actl+ as it is printed%
The Average Program:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
main()
{
char q;
int k;
float number, sum, ave;
system("cls");
sum!;
for(k";k<#;k$$)
{
%rintf("&lease enter a 'umber");
scanf("(f",)number);
%rintf("*n");
sumsum$number;
+
avesum,-;
%rintf(".vera/e is0("!.1f*n",ave);
%rintf("*n");

+
TASK : SA!ING T"E SO#RCE CO$E C PROGRAM
*nce +ou have t+ped the program into the edit window +ou need to save it in a "ile "or
later retrieval% Note that the compiler will onl+ $e a$le to compile a program that has
$een saved to a named "ile% The program is to $e called average%c Note the %c at the
end o" the name, this is ver+ important%
To save the "ile use the 5ile drop down menu item and select )save as)%
Navigate the QUINCY "older% 7nd select the programs "older%
8ere +ou can clic on the )New 5older $utton 'third $utton "rom the Quinc+9::9 edit
$o!%
7 new "older will appear% Call it )m+ programs)%

Enter this new "older and save +our average%c program%
Now +ou are read+ to start to compile +our program%
TASK %: &#I'$ING A COMPI'E$ PROGRAM
;o to the Pro<ect drop down menu item and select the =uild item%
The =uild window will open and +ou will see Quinc+ $uilding +our program%
I" all is well +ou will see the #uccess"ul $uild te!t% I" not there will $e some
in"ormation indicating errors, with the all important line num$er o" the statement
containing the error% -hen +ou have a success"ul $uild, close down the =uild
window%
Now to run the program, clic on the Pro<ect drop2down window again and select the
E!ecute item%
The )&*# st+le) run window will open as illustrated a$ove% Now +ou can enter the
num$ers as invited $+ the program%
Note that when +ou "inish +our program Quinc+ will print out a Press Enter to return
to Quinc+% This is to allow +ou to see +our program output%
Now +ou have completed +our "irst C program e need to loo at how +our can chec
+our program a single instruction at a time%
TASK (: SING'E STEP )EAT#RE
To single step through +our program +ou need to enter the &e$ug drop down menu
and select the #tep item 'or press 5>(%
7s +ou can see in the a$ove screen shot this introduces a green arrow to the le"t o" the
program, pointing at the "irst instruction to $e e!ecuted% Note that at this point the
instruction has not +et $een e!ecuted% You can use 5> to step through the program%
I" +ou loo on the -indows Tas $ar 'not shown in the a$ove screenshot( +ou will
see an /#&*# icon with +our program name 'average(% Clic on this and +ou will
see a &*# window% This is +our programs output window%
I" +ou single step through the program up to the scan"'%%( instruction, then step over
this instruction 'to e!ecute it(, then clic on the /#&*# icon in the tas $ar +ou will
see +our program output with the "irst message%
Enter the "irst num$er into the /#&*# output screen and press enter%
The program will step on and the &*# output window will disappear $ac onto the
tas $ar% This is a common "eature o" the &*# output window% It will not sta+ on the
screen all o" the time, onl+ when +ou evoe it%
Continue to step through the program% It will eep looping $ac to the scan"'%%(
statement, and when +ou e!ecute this statement 'with the 5> e+( +ou can evoe the
&*# window to enter the ne!t value%
In due course the program will terminate and the &*# output window will disappear%
Note that +ou can terminate the program at an+ time $+ simpl+ clicing on the #top
Icon 'red seven sided #top $utton at the top o" the QUINCY -indow(% 7t this point a
-indow will open inviting +ou to end the de$ug session%
TASK *: WATC" WIN$OW )EAT#RE
Using watch window to see what is happening to +our program varia$les%
The varia$les in our program ',, , num$er, sum, and ave( are changing as +our
program is $eing e!ecuted% It is use"ul to $e a$le to "ollow those changes as +ou step
through the program% This is where the watch window comes in hand+%
Clic on the &e$ug drop down menu item and select -atch%
Enter the varia$le name into the ?aria$le te!t $ar o" the 7dd -atch window and
clic on *6%
The varia$le now appears in the watch window 'no value +et since we have not
started to run the program%
Enter varia$le num$er, sum, and ave in a similar manner% 7s +ou can see "rom the
$uttons availa$le in the -atch -indow, +ou can add and delete varia$les to and "rom
the -atch -indow%
Now that +ou have entered all o" the varia$les we wish to watch +ou can now start to
single step through the program with 5>% Note that +ou will need to clic on the edit
window $e"ore QUINCY will respond% This is important so I will sa+ it again1
+hen ,ou evo-e the $OS out.ut /creen ,ou need to c0ic- on the 1#INC2 edit
/creen 3e4ore ,ou can e5ecute the ne5t in/truction +ith the )6 -e,7
You will notice that when +ou "irst start to single step through the program the
varia$les will appear to have odd values% This is ,uite normal since the varia$le will
Contain random values%
The a$ove screenshot shows the program a"ter it has e!ecuted 9 loops o" the program%
Complete the e!ecution o" the program% @emem$er when +ou evoe the &*# output
screen +ou need to clic on the QUINCY edit screen $e"ore +ou can e!ecute the ne!t
instruction with the 5> e+%
TASK 8: &REAKPOINT )EAT#RE
=rea PointsA *"ten +ou will want to e!ecute +our program at "ull speed up to a
particular point, then single step "rom there% This is particularl+ so in a large program
where it might tae ,uite a long time to single step through the program% 7lso, a lot
o" programs will contain program loops 'lie the )"or loop) in the average%c program(
that e!ecute around to loop a large num$er o" times% You might want to e!ecute the
program at "ull speed until the program loop is complete, the single step "rom there%
This is where the =rea Point comes in hand+%
To set up a $rea point place the cursor at the instruction +ou want to set a $rea
point, then clic on the &e$ug drop down menu item and chose )=reapoints) '59
does the same thing(%
7s +ou can see "rom the a$ove screen shot a hand icon is placed at the point in the
program where the $rea point has $een set%
Now start the program using Pro<ect 23 E!ecute and the program will e!ecute as a
normal run, allowing +ou to enter the values as prompted $+ the program% -hen all
values have $een entered, the program will halt at the $reapoint 'set up outside o" the
program loop(%
/ost o" this program activit+ taes place inside o" the )"or loop)% The average value
is calculated outside o" the loop%
Notice that the ;reen arrow is now over the hand icon indicating that the program has
now reached the $rea point% 7t this point +our can single step through the remainder
o" the program%
Tr+ setting up +our own $rea points in the program%
TASK 6: E!A'#ATE )EAT#RE
The Evaluate varia$le is anther use"ul "eature o" the de$ug tools% This can $e used to
change the value o" a varia$le in +our program at an+ point in its e!ecution%
#ometimes +ou want to override a value that has $een calculated in the program% 5or
e!ample, +ou might want to override the value used in the )"or loop) to mae the
program leave the )"or loop) $e"ore it normall+ would% 7ctuall+ this is not a ver+
good e!ample sine in out program it would result in a wrong average answer, $ut the
idea is sound% In our program we could <ust change the value o" a varia$le we have
<ust entered at the e+$oard 'using the scan"'%%( instruction% This is a t+pical use 'we
might have <ust t+ped in the wrong values $+ mistae(%
To use the )evaluate) "eature clic on de$ug, then evaluate%
Enter the varia$le name in the E!pression te!t $o! '+ou could enter the varia$le
num$er here(% Then in the Change te!t $o!, the new value 'sa+ 4(% Now clic on *6
and +our evaluate window should loo lie the one $elow%
Now then +ou continue to e!ecute the program the new value "or num$er '4( will $e
used%
Tr+ changing a "ew other varia$les in the program to get some practice%
-e have now completed the $asic tutorial on how to use QUINCY C I&E%
To learn more a$out QUINCY loo at the help window% This will open up the PCBs
=rowser and +ou can $rowse through the h+perte!t $ased help in"ormation% 7 lot o" it
is what we have <ust done in this tutorial, $ut there is more the+Bre as well%
In particular loo at the help in"ormation on Creating Pro<ects, and stepping over C
"unctions% You will need to now a$out these later on%
E5erci/e: A .rogram +ith mi/ta-e/7
5inall+, tr+ entering the "ollowing C program% It has a num$er o" mistaes in it% You
can learn a lot a$out the error messages produced $+ the QUINCY compiler $+ going
through this e!ercise% 7s +ou can see itCs the same average program $ut with
mistaes% This maes it possi$le "or +ou to correct the mistaes a"ter +ou have had a
chance to see the error messages produced $+ the compiler%
In particular, note the line num$ers given $+ the compiler%
#include <stdio.h>
#include <conio.h>
#included <stdlib.h>
mainy()
{
cha q;
inte/er k;
float number, sum, ave;
system("sto%");
sun!;
for(k";k<#;k$$)
{
%rintf(&lease enter a 'umber);
scanf("(d",)number);
%rint("*n");
sumsum$number;
+
avesum,-;
%rintf(".vera/e is0("!.1f*n",ave);
%rintf("*n");

+
Note that as +ou correct each error re2compile with $uild so +ou can see the e""ect%
You might "ind that as some o" the errors disappear, new ones appear%
P&/9::D%