0% found this document useful (0 votes)
32 views

CPP Lec1

The document provides an introduction to programming in C++, outlining course objectives to learn computational thinking tools, C++ vocabulary, and computational capabilities and limitations. It recommends textbooks and online resources for learning C++ and describes the aims of the introductory lecture to test programming knowledge and introduce basic C++ tools. The document also gives examples of algorithms and programs, and explains the processing of a program from source code to executable file.

Uploaded by

Hemed hafidh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

CPP Lec1

The document provides an introduction to programming in C++, outlining course objectives to learn computational thinking tools, C++ vocabulary, and computational capabilities and limitations. It recommends textbooks and online resources for learning C++ and describes the aims of the introductory lecture to test programming knowledge and introduce basic C++ tools. The document also gives examples of algorithms and programs, and explains the processing of a program from source code to executable file.

Uploaded by

Hemed hafidh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Introduction to

Programming in C++
Lecture 1:
Introduction
Course Objectives

 Ability to use the basic tools of computational


thinking to write small scale programs.
 Ability to use a vocabulary of computational
tools to understand programs written by
others.
 Understand the fundamental capabilities and
limitations of computation.
 Learn how to map engineering and scientific
problems in to a computational framework.
Recommended Text Books

 Deitel & Deitel, C++ How To Program, 8th


Edition, Prentice Hall, 2012. ISBN: 10:0-273-
75276-6
 D.S. Malik, C++ Programning: From Problem
Analysis to Program Design.

 The internet!!
 http://www.cplusplus.com/doc/tutorial/
 http://www.cprogramming.com/tutorial.html
 http://www2.research.att.com/~bs/C++.html
Aim of Lecture

 To test the student’s depth of knowledge in


Computer engineering and programming.
 To introduce the basic tools required for
programming in C++.
Why Programming?

This is the Computer hardware, BUT:


Q. Who tells the Computer what to do?
A: This is the role of a software
program
Algorithm Example
Program Vs Software

 A computer program is…


 A set of instructions for a computer to follow/ A
program is an implementation of an algorithm

 Computer software is …
 The collection of programs used by a
computer
 Includes:
 Editors
 Translators
 System Managers
More on programs…

 The CPU executes instructions one after the other.

 Such a sequence of instructions is called a “program”

 Without a program, the computer is just useless hardware

 Complex programs may contain millions of instructions

 The program is stored in the Memory and executed one at a


time by the CPU

 However, in what form is the program stored in memory?


Machine Language
 Binary System
 Only ‘ 0 ’ and ‘ 1 ’ digits
 Can be easily implemented in electronic Decimal Binary
circuits
 ‘ A’ may look like 01000001 0 000
 65 may look like 01000001 1 001
 An instruction may look like 01000001
2 010
 How does the computer know the 3 011
meaning
of 01000001? 4 100
 Interpretation depends on the current
instruction 5 101
 Programmers rarely need to be 6 110
concerned with this problem. 7 111
 Reason as if memory locations contain
letters and numbers rather than
zeroes
and ones
High-Level Languages
 High-level languages use human
understandable format to describe
programs
High-level language Machine Language
Voltage = Current X 100100 010001 (LOAD Current)
Resistance 100110 010010 (MULT
Resistance)
100010 010011 (STORE
Voltage)

 If given the choice, which one would you


choose?
Why C++?

 Programming principles, concepts and


techniques can only be acquired by doing lots
of programming.
 Programming is like riding a bike —it can’t be
learned from a book, it requires lots of practice.
 So we have to learn via a particular programming
language.
 On this course we will use C++, the language
most widely used in Engineering
 C++ forms a good basis for learning both C and
Java.
Processing of a Program

source
code
Definitions

 Compiler: A (very complex) program that


converts a high-level language program to a
machine language version.
 Object Program: Machine language version
of the high-level language program.
 Linker: A program that combines object files
together to produce the executable file.
Your First C++ Program

 Algorithm
1. ask the user for the first number
2. ask the user for the second number
3. add the two numbers
4. display the result on the screen
//This program performs a basic addition operation of two numbers

#include <iostream>

using namespace std;

int main()
{
int a, b, c; //Variable declaration

cout << "Enter First Value: " << endl;


cin >> a;
cout << "Enter Second Value: " << endl;
cin >> b;

c = a + b; //addition takes
place here
cout <<"The result of addition is: " << c;
return 0;
}
Loaded to
Memory Run by CPU
one instruction
at a time
IDEs
 Integrated Development Environments or IDEs
 Supports the entire software development cycle
 E.g., MS Visual C++, Borland, Code Warrior
 Provides all the capabilities for developing software
 Editor
 Compiler
 Linker
 Loader
 Debugger
 Viewer
Any General Questions

 This is your chance…Ask ANY Question…No


matter how simple.

You might also like