Programming Fundamental First lecture What is include include

  • Slides: 25
Download presentation
Programming Fundamental First lecture

Programming Fundamental First lecture

What is # include? ? • # include is a pre-processer directive. It tells

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

What is iostream. h? • This is the name of the library definition for

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

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

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

What are {}? ? • These are called braces allows to group together pieces

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

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

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

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

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

What is semicolon ; ? • Semicolon is very important. C statements end with

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.

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

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

What is character string? • Which text that is written in “ ” display

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

What is variables? • Variables are location in memory for storing data. Data stored

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

What is = operater? • In C = sign is used as a assignment

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

What are data types? • Data types are reserved words of C language and

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

Assignment 1 • • • Names of Data Types? ? ? How many types

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

Operators? ? • Different operators have different precedence in C • *, /, %

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 the operator which occurs first from left will be evaluated first and then next

Getch? ? • Hold the output screen when we press enter then it will

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

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

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

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

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

2 nd program • Write a program which have 4 variables a , b

2 nd 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

Example of expression • Algebra y=ax 2+bx+c • IN C y= a*x*x+b*x+c • In

Example of expression • Algebra y=ax 2+bx+c • IN C y= a*x*x+b*x+c • In prenthesis y= a*(x*x)+(b*x)+c

Example of expression • X=ax+by+cz 2 • In c ? ? ? • X=a*x+b*y+c*z*z

Example of expression • X=ax+by+cz 2 • 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)

Example of expression • Example • (b 2 -4 ac)/2 a is equal to

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

3 rd program calculate the average of a class of five students. Prompt the

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

4 th program • Takes 2 variables a=10, b=20 and swap these values with

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

Assignment 2 • Takes 2 variables a=10, b=20 and swap these values without using

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