Upcoming SlideShare
×

# C++,logical statements and assighnment statement

821 views

Published on

i had made it with hard work so i offer it you because i can feel your feelings text tym i shall upload mora beautiful and comprehensive ppts.

Published in: Education, Technology, Spiritual
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
821
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### C++,logical statements and assighnment statement

1. 1.
2. 2.
3. 3. Switch statement Logical Statement Assignment Statement <br />Computer programming<br />C++ <br />
4. 4. Instructor<br /> Sir AamirJamshid<br />
5. 5. Crew Members<br />AzeemMumtaz<br />SaqibMunawar<br />Hafiz Ashfaq<br />M.ZeeshanArshad<br />
6. 6. Logical Statements<br />AND operator<br />It is used to evaluate two conditions .<br />It produces true result if both conditions are true<br />It produces false if any one condition is false<br />Symbol:<br /> “&&”<br />
7. 7. Working<br />
8. 8. Example<br />
9. 9. Output<br />Enter the first number<br />1<br />Enter the second number<br />0<br />0<br />
10. 10. OR operator<br />It is used to evaluate two conditions<br />It produces true if either condition is true <br />It produces false result if both conditions are false<br />Symbol:<br /> “| |”<br />
11. 11. Working<br />
12. 12. Example<br />
13. 13. Output <br />Enter the first number<br />1<br />Enter the second number<br />0<br />1<br />
14. 14. Not Operator<br />It is the reverses the result of condition<br />It gives True if condition is false<br />It gives false if condition is true<br />Symbol:<br /> “!”<br />
15. 15. Example<br /> ≡ File Edit Search Run Compile Debug Project Options Window Help<br />╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗<br />║#include<iostream.h> ▲<br />║#include<conio.h> ■<br />║void main() ▒<br />║{ ▒<br />║clrscr(); ▒<br />║int a; ▒<br />║cout<<"Enter the number"<<endl; ▒<br />║cin>>a; ▒<br />║if(a%2!=0) ▒<br />║cout<<"the number is odd"; ▒<br />║else ▒<br />║cout<<"the number is even"; ▒<br />║getch(); ▒<br />║} ▼<br />╚═☼════ 14:3 ═════◄■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘<br />┌────────────────────────────────── Message ─────────────────────────────2─────┐<br />│•Compiling NONAME00.CPP: │<br />│ Linking TCDEF.EXE: │<br />│ │<br />│ │<br />│ │<br />└──────────────────────────────────────────────────────────────────────────────┘<br /> F1 Help Alt-F8 Next Msg Alt-F7 PrevMsg Alt-F9 Compile F9 Make F10 Menu<br />
16. 16. Output<br />Enter the number<br />8<br />The number is even<br />
17. 17. Hafiz Ashfaq<br />
18. 18. Assignment Statement <br />A statement that assigns a value to a variable is known as assignment statement.<br />The assignment =is used in assignment statement<br />to assign a value or computational result to a variable.<br />The name of variable is written on the left side of assignment operator and the value is written on the right side. The value can be a constant ,variable ,expression or a function.<br />
19. 19. Syntax <br />Variable=Expression<br />Examples<br />A=100;<br />C=a+b;<br />X=c-d+10;<br />
20. 20. LVALUE & RVALUE<br />An L value is an operand that can be written on the left side of assignment operator=it must always be a single value.<br />An rvalue is an operand that can be written on the right side of assignment statement=.<br />All Lvaues can be used as Rvalues.<br />
21. 21. Example<br /> ≡ File Edit Search Run Compile Debug Project Options Window Help<br />╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗<br />║#include<iostream.h> ▲<br />║#include<conio.h> ■<br />║void main() ▒<br />║{clrscr(); ▒<br />║inta,b; ▒<br />║a=10; ▒<br />║b=5; ▒<br />║cout<<"a+b="<<a+b<<endl; ▒<br />║cout<<"a-b="<<a-b<<endl; ▒<br />║cout<<"a*b="<<a*b<<endl; ▒<br />║cout<<"a/b="<<a/b<<endl; ▒<br />║cout<<"a%b="<<a%b<<endl; ▒<br />║getch(); ▒<br />║} ▼<br />╚═☼════ 14:2 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘<br />┌────────────────────────────────── Message ─────────────────────────────2─────┐<br />│•Compiling NONAME00.CPP: │<br />│ Linking NONAME00.EXE: │<br />│ │<br />│ │<br />│ │<br />└──────────────────────────────────────────────────────────────────────────────┘<br /> F1 Help Alt-F8 Next Msg Alt-F7 PrevMsg Alt-F9 Compile F9 Make F10 Menu<br />