Khalid Rasheed Shaikh Computer Programming Theory 1.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 2 Simple C Programs.
Advertisements

Introduction to C Programming
C Language.
ARDUINO CLUB Session 1: C & An Introduction to Linux.
Computer Programming w/ Eng. Applications
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Programming In C++ Spring Semester 2013 Lecture 2 Programming In C++, Lecture 2.
11-2 Identify the parts of the “main” function, which include Preprocessor Directives main function header main function body which includes Declaration.
Software Development Method. Assignments Due – Homework 0, Warmup Reading – Chapter 2 –
The scanf Function The scanf function reads input from the standard input device into one or more variables Example: scanf(“%lf”, &miles); Reads a real.
C programming.
C programming an Introduction. Types There are only a few basic data types in C. char a character int an integer, in the range -32,767 to 32,767 long.
1 CSE1301 Computer Programming Lecture 5: Components of a C Program (Part 1)
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Basic Input/Output and Variables Ethan Cerami New York
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
Introduction to C Language
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Computer Science 210 Computer Organization Introduction to C.
Intro to Java Programming  A computer follows the instruction precisely and exactly.  Anything has to be declared and defined before it can be used.
Chapter 2 Getting Started in C Programming
Chapter 5: Data Input and Output Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills
Chapter 2 : Overview of C By Suraya Alias. /*The classic HelloWorld */ #include int main(void) { printf(“Hello World!!"); return 0; }
Reading the data from the input devices and displaying the results on the screen are the two main tasks of any program. To perform these tasks user friendly.
 Input and Output Functions Input and Output Functions  OperatorsOperators Arithmetic Operators Assignment Operators Relational Operators Logical Operators.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
1 CSE1301 Computer Programming Lecture 5: Components of a C Program (Part 1) Linda M c Iver.
UniMAP Sem1-07/08EKT120: Computer Programming1 Week2.
Constants Numeric Constants Integer Constants Floating Point Constants Character Constants Expressions Arithmetic Operators Assignment Operators Relational.
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
CECS 121 Test 1. Functions allow you to group program statements under one name C and C++ are case-sensitive so main(), MAIN(), and Main() are all different.
THE BASICS OF A C++ PROGRAM EDP 4 / MATH 23 TTH 5:45 – 7:15.
Introduction to Programming
CC112 Structured Programming Lecture 2 1 Arab Academy for Science and Technology and Maritime Transport College of Engineering and Technology Computer.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 3: Introduction to C: Input & Output, Assignments, Math functions.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
Types of Operator Arithmetic operator Relational operator Logical operator Assignment operator Increment or decrement operator(unary) Bitwise operator.
A.Abhari CPS1251 Topic 2: C Overview C Language Elements Variable Declaration and Data Types Statement Execution C Program Layout Formatting Output Interactive.
UniMAP Sem I-09/10EKT150: Computer Programming1 Week 2 – Introduction to Computer and Algorithm.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
UNIMAP Sem2-07/08EKT120: Computer Programming1 Week 2 – Introduction to Programming.
Dr. Sajib Datta Jan 21,  Declare a variable ◦ int height; [note that no value is still assigned]  Assign a variable a value ◦ height =
C Building Block Chapter 2. Variables A variable is a space in the computer’s memory set aside for a certain kind of data and given a name for easy reference.
NOTE: C programs consist of functions one of which must be main. C programs consist of functions one of which must be main. Every C program begins executing.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
C Language Elements Preprocessor Directives # (sign for preprocessor directive commands) #include Standard header file (.h) Library.
From Algorithms to Programs Both are sets of instructions on how to do a task Algorithm: –talking to humans, easy to understand –in plain (English) language.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
Lecture2.
Computer Science 210 Computer Organization
CSE 220 – C Programming C Fundamentals.
Computer Science 210 Computer Organization
Input and Output: I/O Finish reading chapters 1 and 2 of the text
INC 161 , CPE 100 Computer Programming
Test Review Computer Science History
By: Syed Shahrukh Haider
Administrative things
Visit for more Learning Resources
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Lecture3.
C Programming Getting started Variables Basic C operators Conditionals
EECE.2160 ECE Application Programming
C – Programming Language
Programming Languages and Paradigms
CSCE 206 Lab Structured Programming in C
EECE.2160 ECE Application Programming
DATA TYPES There are four basic data types associated with variables:
Course Outcomes of Programming In C (PIC) (17212, C203):
Presentation transcript:

Khalid Rasheed Shaikh Computer Programming Theory 1

Programming Environment Command Line IDE (Integrated Development System)

Library and Run-Time Files library Files Math Library Run-Time Object Files Header Files Programmer Generated Files

Writing a program void main(void){ printf("I can speak German"); } Saving Programe Making an.EXE Compiling Linking Executing a Program

Errors Syntax Errors Logical Errors

Basic Structure of C programs Function Definition Delimiters Statement Terminator Program Style, Round One o void main(void){ printf("Hello");}

The printf Function printf("My First C Program");

Exploring the printf function Printing Numbers o printf("Number: %d", 2) ; Format Specifiers Printing String o printf("$s is an %s" 2, "int") Printing Characters

Variables Constant and Variables o Defining o Declaring o Assigning

Variables Type int char float double

Input / Output float flt = 2.3; printf("%.1f", flt);

The scanf() Function float years, days; printf("Enter age in Years"); scanf("%f",&years); days = years*365; printf("Your age is %.1f", days)

The Address Operator (&) scanf("%f",&years); printf("Address = %d, value = %f ", years, &years);

Operators Arithmetic Operators Operator Precedence o (B)rackets, (O)rder, (D)ivision, (M)ultiplication, (A)ddition, (S)ubtraction The Reminder Operator o answer = 13 % 5; Expression Vs Variables o days = years * 365 Arithmetic Assignment Operators Increment operators Relational operators