CSE 1062 Fundamentals of Programming Lecture #2: Spring 2017

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

ASTU

CSE 1062 Fundamentals of Programming

Lecture #2

Spring 2017

Computer Science & Engineering Program


The School of EE & Computing
Adama Science & Technology University
ASTU

Getting Familiar with the C++ Environment


• Software Requirement
• Opening an IDE
• Creating new Project
• Workspace and Projects manager
• Changing Code Blocks Settings
• Our First C++ Program

2
Software Requirement ASTU

• A C++ Compiler
• GCC(MinGW) Compiler<=Preferred
• Microsoft Visual C++ 2010
• Borland C++ Compiler 5.82
• An IDE
– Code Blocks<=Preferred
– Microsoft Visual C++ 2010 Express Studio
– Turbo C++

3
Opening an IDE ASTU

– IDE= Integrated Development Environment


• A set of programming tools for writing
applications (source code editor, compiler, linker,
debugger, etc.), all activated from a common
user interface and menus.
– Open Code Blocks

4
The Environment ASTU

5
Create a new Project ASTU

• An application is a runnable program.


Most applications are built from multiple
source files.
– Code::Blocks keep track of the files and compiler
settings need to build an application with a project file

6
ASTU

• We use Console Applications


– An application that uses the command line
for input and output rather than a graphical
interface (GUI).

7
The Console Application Wizard ASTU

8
Project Properties ASTU

• Give descriptive project title


• Create a folder on c: drive(preferred) or
use existing folder

9
Project Properties ASTU

• Cbp=Code Blocks Project

10
Select Compiler ASTU

11
Workspace and Project Manager ASTU

• Workspace collects projects together


• where you can easily switch between projects
• The Projects are listed on the Manager
– One sample c++ source file is inserted
• Can’t see Manager?
– make sure it is checked on the view menu

12
Windows Explorer ASTU

• View your Project in Windows Explorer

13
Settings ASTU

• We can change settings as desired

14
Empty Files ASTU

• You can also create empty files

15
ASTU

• Then Save file

16
Empty Files ASTU

• Save it as a C++ file

17
Empty Files ASTU

• Then you can build and run as usual

• You can create additional empty files


and build, run

18
Environment Setting ASTU

19
Compiler Settings ASTU

• Don’t change this if you didn’t install


additional compilers separately

20
Our First C++ Program ASTU

21
Namespace and Libraries ASTU

• A namespace is a collection of name


definitions.
– One name, such as a function name, can be
given different definitions in
two namespaces.
– A program can then use one of these
namespaces in one place and the other in
another location.

22
Namespace and Libraries ASTU

• All the standard libraries we will be using


place their definitions in the
std(standard) namespace.
– It is almost impossible to write a C++
program without using at least one of these
libraries.
• To use any of these definitions in your
program, you must insert the following
using directive:
using namespace std;

23
Namespace and Libraries ASTU

• For example, the library for console I/O


is iostream. So, most of our
demonstration programs will begin
#include <iostream>

24
Build and Run ASTU

• Build: The source program will be


compiled and linker links the object files
created by the compiler into an
executable
• Run: The program will be in memory

25
Console Screen ASTU

• We can change the color and Font of the


console
– Right click on the title bar
– Choose properties

26

You might also like