Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Fundamental

Similar presentations


Presentation on theme: "Programming Fundamental"— Presentation transcript:

1 Programming Fundamental
First lecture

2 What is # include?? # include is a pre-processer directive. It tells the compiler to include the contents of file about the system file iostream.h

3 What is iostream.h? This is the name of the library definition for all input output streams

4 What is ()? These are parentheses and also used with main

5 What are {}?? These are called braces allows to group together pieces of a program. The body of main enclosed with braces.

6 What is cout? This is known as output stream in c and c++

7 What are << ?? The sign << indicates the direction of data

8 What is semicolon ; ? Semicolon is very important. C statements end with semicolon. Missing of a semicolon in statement is called syntax error. And do not put semicolon at wrong place because it may cause a problem during the execution of program or may cause the logical error.

9 What is “ “? These commas are called character string for example “Fatima” is a character string

10 What is character string?
Which text that is written in “ ” display or print as it is when program will be execute

11 What is variables? Variables are location in memory for storing data. Data stored in variables Variables name in c may be started with a character or an (_) underscore Every variable has name, size, value etc

12 What is = operater? In C = sign is used as a assignment operator for example a=10; b=20; a=b; means the value of b assign to a. this operator takes the value of right hand side and stores into left hand side operator

13 What are data types? Data types are reserved words of C language and cannot be used as a variable name. Different data types have different size in memory depending on a machine and compiler

14 Assignment 1 Names of Data Types??? How many types of Data types???
Sizes of Data Types??? Works of Data types??? Declaration of Data types???

15 Operators?? Different operators have different precedence in C
*, /, % , have highest precedence after parentheses % remainder operator returns the remaining value after division If *and / operators in an expression then the operator which occurs first from left will be evaluated first and then next

16 Getch?? Hold the output screen when we press enter then it will be close Conio.h library uses for getch function

17 Getche?? It shows also input in our black screen

18 Sample program Write a program which prints the “your name” on screen

19 2nd program Write a program which have 4 variables a ,b ,c ,d. then takes the input from user about values and calculate the sum of these values

20 Example of expression Algebra y=ax2+bx+c IN C y= a*x*x+b*x+c
In prenthesis y= a*(x*x)+(b*x)+c

21 Example of expression X=ax+by+cz2 In c ??? X=a*x+b*y+c*z*z
In prenthesis x=(a*x)+(b*y)+c(z*z)? x=(a*x)+(b*y)+c*(z*z)

22 Example of expression Example (b2-4ac)/2a is equal to b2-4ac/2a?????
In c (b*b-4*a*c)/2*a In prenthesis (b*b-4*a*C)/(2*a)

23 3rd program calculate the average age of a class of five students. Prompt the user to enter the age of each student.

24 4th program Takes 2 variables a=10, b=20 and swap these values with the help of 3rd variable

25 Assignment 2 Takes 2 variables a=10, b=20 and swap these values without using 3rd variable


Download ppt "Programming Fundamental"

Similar presentations


Ads by Google