0% found this document useful (0 votes)
89 views2 pages

CS111 - Tutorial/Laboratory - Week 2: Programming Exercise 2.1 - Introduction To The IDE

The document provides instructions for three programming exercises to introduce students to using an IDE: the first has students open and close the IDE to configure it, the second has them write a basic "Hello World" program, and the third has them write a program to print a welcome message and list of prices for beverages at a cafe.

Uploaded by

Rahul Narayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views2 pages

CS111 - Tutorial/Laboratory - Week 2: Programming Exercise 2.1 - Introduction To The IDE

The document provides instructions for three programming exercises to introduce students to using an IDE: the first has students open and close the IDE to configure it, the second has them write a basic "Hello World" program, and the third has them write a program to print a welcome message and list of prices for beverages at a cafe.

Uploaded by

Rahul Narayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS111 – Tutorial/Laboratory – Week 2

Programming Exercise 2.1 - Introduction to the IDE


In this exercise, you are asked to start the IDE once and close it. The reason is to make sure
that it is configured correctly once. Closing it ensures that the configuration is stored for
future use.
1. Go to START and search for Dev-C++
2. Click on "Next" or "Yes" until the program completely starts
3. Exit the program.

Programming Exercise 2.2 - Hello World


Just about every programmer in the world has written the Hello World program. This
exercise will give you practice on writing your own Hello World program from scratch, get it
compiled and have it run.
1. Start Dev-C++. If it’s already open, close it and start it again.
2. Create a new source file and save it as hello. Remember that you don’t have to add
the extension .cpp. Dev will automatically add it to the file name.
3. Delete all the code that is in the text editor window.
4. In its place, type the following C++ code. Don’t worry about the details of the
program. Just type it exactly as it is:

// Hello World Program


#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!\n";
return 0;
}
Note, that as you typed, the 2 lines between the braces { } are indented automatically!
5. It is good practice to continually save your work – just in case you accidentally
overwrite an hour’s work. Save by clicking Save in the File menu or use the shortcut
CTRL-S, best after every line of typing. You will regret any saving laziness – trust me!
6. Once you have entered your source code, compile it.
7. If any errors are reported, see the compiler error pane by clicking the compiler tab.
Double-clicking any error will take you to the line of your program that contains the
error. Try to correct all the compiler errors in the edit pane, then re-compile the
code.
8. If there are no errors, go ahead and execute your program.
9. Finally, add a 2nd comment line with your name and the current date. Re-compile.
Programming Exercise 2.3 - Welcome Message
Write a program that prints a welcome message to screen for customers of the
Programmers’ Café (see the case study below). The message should say what customers can
buy and perhaps print a list with prices. If you have problems with formatting or compiling
ask your tutor or your neighbour.
Save this program in a file called ProjectA01.cpp on your USB drive. You will continue
working on this program for the next few weeks.

Case Study.
Design a console-based order-processing program for the Programmers’ Café.
Programmers’ Café is a locally owned and operated coffee house with the finest beverage
selection in the country. It offers beverages made from the finest ingredients. Currently, it
serves the following beverages:

Beverage Regular Large Extra Large


Long Black $3.50 $3.70 $4.00
Flat White $3.80 $4.20 $4.50
Cappuccino $4.00 $4.30 $5.00
Tea $3.00 $3.20 $3.50

You might also like