1 / 11

Computer Programming Code: CS1112

Computer Programming Code: CS1112. Lecture No. 2 Bilal Ashfaq Ahmed. First C Program. // Welcome program #include<iostream.h> main() { cout<<“ Welcome to UOL !”; }. Escape Sequence. Syntax. Errors &Types.

lapis
Download Presentation

Computer Programming Code: CS1112

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer ProgrammingCode: CS1112 Lecture No. 2 Bilal Ashfaq Ahmed

  2. First C Program // Welcome program #include<iostream.h> main() { cout<<“ Welcome to UOL !”; }

  3. Escape Sequence

  4. Syntax Errors &Types The syntax of a programming language specifies the rules for creating a proper program in that language.

  5. C++ keywords • Predefined special purpose word • Know as ‘Reserved word’ • Can’t be used as variable or function name

  6. Variable Variable is the name of a location in the memory . • ABC 3453 • 0002

  7. Rules of Variable The name of a variable, its identifier, can be composed of letters, digits, and the underscore character. Variable starts with • Character • Underscore ‘_’ (Not Recommended)

  8. Variable In a program every variable has • Name • Type • Size • Value

  9. Assignment Operator “=” • Assignment operator is a binary operator (a binary operator has two operands). • Assign values to the two variables • Causes the value on the right to be assigned to the variable on the left. • The = in C++ is equivalent to the := in Pascal or the = in BASIC. • E.g. X = 5, X = 10 + 5, and X = X +1.

  10. Data Types A variable must have a data type associated with it, for example it can have data types like integer, decimal numbers, characters etc. The variable of type Integer stores integer values and a character type variable stores character value. The primary difference between various data types is their size in memory. Different data types have different size in memory depending on the machine and compilers. Five basic types • int • float • double • char • void

More Related