Computer Programming Chapter 1: Introduction

Slides:



Advertisements
Similar presentations
Week 4 – Functions Introduction. Functions: Purpose Breaking a large problem into a series of smaller problems is a common problem- solving technique.
Advertisements

CSE202: Lecture 1The Ohio State University1 Introduction to C++
Lecture 2 Introduction to C Programming
Introduction to C Programming
C Introduction Lesson CS1313 Spring C Introduction Lesson Outline 1.C Introduction Lesson Outline 2. hello_world.c 3.C Character Set 4.C is Case.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
Programming The Development Environment and Your First C Program.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
1 Software John Sum Institute of Technology Management National Chung Hsing University.
Hello World 2 What does all that mean?.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Programming With C.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
CHAPTER 2 PART #1 C++ PROGRAM STRUCTURE 1 st semester H 1 King Saud University College of Applied studies and Community Service Csc 1101 By:
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
PHYS 2020 Basic C An introduction to writing simple but useful programs in C In these lectures I will take you through the basics of C, but you will need.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Chapter 2: Getting Started.
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
Chapter 2 part #1 C++ Program Structure
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Introduction to C++.  Computers: CPU, Memory & Input / Output (IO)  Program: Sequence of instructions for the computer.  Operating system: Program.
Program Development Cycle 1.Edit program 2.Compile program - translates it from C to machine language 3. Run/execute your program. 4. If not satisfied,
Computer Programming A simple example /* HelloWorld: A simple C program */ #include int main (void) { printf (“Hello world!\n”); return.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Lecture 4 Computer Programming // sample C++ program #include using namespace std; int main() { cout
STRUCTURED PROGRAMMING Complete C++ Program. Content 2  Main Function  Preprocessor directives  User comments  Escape characters  cout statement.
CSCE 206 Structured Programming in C
Topic Pre-processor cout To output a message.
CHAPTER 2 PART #1 C++ PROGRAM STRUCTURE
ANNOUNCEMENT The missed lecture will be made up this Monday evening in the Tech PC classroom (MG51). A tentative time interval is 6:30-8:00. The exact.
INC 161 , CPE 100 Computer Programming
Introduction to C Language
Chapter 2 - Introduction to C Programming
Computer Programming Techniques Semester 1, 1998
Chapter 2, Part I Introduction to C Programming
Chapter 2 part #1 C++ Program Structure
Computer Programming Chapter 10: Array in Functions
Computer Programming Chapter 5: Switch statement
Introduction to C Language
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Day 01 Introduction to Linux and C
Getting Started with C.
Chapter 2 - Introduction to C Programming
Computer Science 210 Computer Organization
Hello World 2 What does all that mean?.
Chapter 2 - Introduction to C Programming
Software John Sum Institute of Technology Management
Chapter 2 - Introduction to C Programming
Introduction to CS Your First C Programs
مباني كامپيوتر و برنامه سازي
Chapter 2 - Introduction to C Programming
Govt. Polytechnic,Dhangar
Creating your first C program
Chapter 2 - Introduction to C Programming
Programming Fundamentals Lecture #3 Overview of Computer Programming
Chapter 2 - Introduction to C Programming
Output Manipulation.
Introduction to Programming - 1
Introduction to C Programming
Chapter 2 part #1 C++ Program Structure
Getting Started With Coding
Presentation transcript:

Computer Programming Chapter 1: Introduction by Mohd Jamil Mohamed Mokhtarudin Faculty of Mechanical Engineering mohdjamil@ump.edu.my

Chapter Description Aims Expected Outcomes To understand the purpose of programming To understand the basic structure of C programming Expected Outcomes Gain understanding of the purpose of programming Know the structure of C programming

What is programming? Autopilot in aeroplane Automatic washing machine Math problem Programming I can do all that with my program!

I am actually dumb without programming. A computer without a program is just a piece of trash!

Programing Language A program tells computer what to do. We have to write program for computer before the computer can do the tasks we want. There are many types of programming language (eg: C, C++, FORTRAN, PHYTON, JAVA etc). We are going to learn C programming language.

Example of C Program

Comments Text surrounded by /* and */ is ignored by computer Used when you want to describe something in your program

stdio.h is a header (standard input and output) It allows for the program to use printf and scanf functions There are many other headers #include is a directive – it searches for the header file in system directories

Examples of Header complex.h – programming with complex numbers math.h – using of common mathematical functions string.h – contains functions to handle string type data

int main(){ } This is a mandatory function in C int – means the return type of the function is integer main() – it is where the program compiler starts running No C program without main() Your code is mostly put inside { }

printf(“Hello, world\n”); Instructs the computer to display Hello, world The entire line is called a statement All statement must end with a semicolon (;) \n – is called escape character

Examples of escape characters Escape code Description \a Produces an alert sound \n Moves the cursor to new line \\ Produces \ character \” Produces “ character There are many other escape code. Can you find out?

return 0; To return from the function main() It is a way to exit a function Return value 0 means success – 1 means failure

Conclusion of The Chapter Programming is an important for a computer to function