Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Computer System & Programming
(CS101)
Ansar Javed
Credits Hours: 2 + 1
Outline
What is this Course About ?
Objective of the course and outline
Administrative Details
What are computers ?
Simple program logic
The steps in the program development cycle
Pse
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Excel Tutorial to Improve Your Efficiency (2007 Version)
Introduction
My purpose with this Excel tutorial is to illustrate some Excel tips that will dramatically improve
your efficiency. I make no attempt to be as encyclopedic as some of the 800page Exce
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Computer System and Programming
(CS1012)
Lecture 2
Ansar Javed
Yesterdays Lecture
What is this Course About ?
Objective of the course and outline
Administrative Details
What are computers ?
Type of Computers
Todays Lecture
Looking Inside of Computer
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Decision Making
Relational Expressions
Type of logical expression
Produces result of true or false
Compares values of two arithmetic
expressions
left_operand relational_operator right_operand
Simple If/Else Statement
if (expression)
cfw_
statement1a;
sta
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
11
CHAPTER
RECORDS (structs)
I N T H I S C H A P TYO
E RU, W I L L :
.
Learn about records
struct
(
s)
.
Examine various operations on
struct
a
.
Explore ways to manipulate data using
struct
a
.
Learn about the relationship between
struct
a
.
Discover how
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
File Operations
1
rd
Starting Out with C+, 3 Edition
12.1 What is a File?
A file is a collection on information, usually stored on a computers
disk. Information can be saved to files and then later reused.
2
rd
Starting Out with C+, 3 Edition
12.2 File N
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Programming Logic and
Design
Sixth Edition
Chapter 2
Working with Data, Creating Modules,
and Designing HighQuality Programs
Credits: Most of the content is from slides provided by author of the textbook.
2
HelloWorld.cpp
#include <iostream>
using namesp
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
GETTING STARTED
WITH C+
Reviewing what we have studies till now in
context of C+
Main Memory
Stores information to be process or instructions to be
executed
Information stored in bits (binary digits)
Two states: on or off
Byte is 8 bits (character of
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
NUMBER SYSTEMS
Binary
Octal
Decimal
Hexadecimal
Base 2
Base 8
Base 10
Base 16
DECIMAL
Normally, we count things in base 10. The
base is completely arbitrary. The only
reason that people have traditionally used
base 10 is that they have 10 fingers,
which h
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Mohammad Ali Jinnah University Islamabad
Department of Computer Science,
Faculty of Computing
Lab 1: Formatting using Escape Sequences
Lab 1: Formatting using Escape Sequences
Table of Contents
1.
Introduction
2
2.
Activity Timeboxing
2
3.
Objective of t
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Algorithm and Programming
ALGORITHM
An algorithm is an ordered set of unambiguous, executable steps that
defines a terminating process
Polyas Problem Solving Steps
Understand the problem
Devise a plan for solving the problem
Carry out the plan
Evaluate t
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Introduction to Computer Programming
(CS1133)
INTRODUCTION
The term computer is derived from the compute, which
means to calculate or to calculate
Computer is an electronic device which is used to solve
different problems according to a set of instruct
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Control Structures
ARITHMETIC OPERATORS
Arithmetic Operators:
+ (addition),  (subtraction or negation), * (multiplication), / (division), % (mod,
(modulus or remainder)
Can use the operators +, , *, and / with both integral and floatingpoint
data typ
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Control Structures
CONTROL STRUCTURES
Control structures can be of three types
Sequence
Selection (by making a choice)
Repetition
SEQUENCE
Simple sequential programs
With such a program, the computer starts at the
beginning and follows the statement
Capital University of Science and Technology, Islamabad
Computer Programming
BS COMPUTE CS1123

Spring 2016
Simple Array Program
Task 1
#include<iostream>
using namespace std;
void main()
cfw_
int arr[5];
for (int i = 0; i < 5; i+)
cfw_
cout < "PLEASE ENTER THE NUMBER AT INDEX = "<i<endl;
cin > arr[i];
Task 2
#include<iostream>
using namespace std;
void main(