The student’s work: Yunis Banafi
The teacher’s name: Ibrahim Aledane
College's name: CTE
Introduction of “If statement”
There are six parts:
• Frist part; the Definition of IF STATEMENT.
• Second part; Basic If Statement Syntax.
• Third part; Operations for making condition.
• Fourth part; Pseudocode
• Fifth part; Flowchart
• Sixth part; Executing the program
First part; the Definition of IF
STATEMENT
• "If statement“ It is a program uses
to compare the input data with a condition; to
decide what to do if the input data matches
the condition or not.
Second part; Basic If Statement Syntax
1- “IF” uses with first condition that evaluates to
true.
2- “Else IF” use with second condition and more
that evaluates to true.
3- “Else” come after “IF” or “Else if” it use
without condition and it evaluates to false.
Third part; Operations for making
condition
• > greater than 5 > 4 is TRUE
• < less than 4 < 5 is TRUE
• >= greater than or equal 4 >= 4 is TRUE
• <= less than or equal 3 <= 4 is TRUE
• == equal to 5 == 5 is TRUE
• != not equal to 5 != 4 is TRUE
Fourth Part; Pseudocode
1- Start.
2- Enter the age.
3- calculate the age.
4- if age>50 print you are not acceptable to register
for the job.
5- else if age>19 print you are acceptable to register
for the job.
6- else print you are too young to register for the
job.
7- End.
Fifth part; Flow chart
start
Calculate the age
Enter the age
Flowchart
If(age>=50)
Else
If(age>=19)
else
Y
N
N
NY
You are not acceptable
to register for the job
You are Acceptable to
register for the job
You are too young
for the job to
registerEnd
print
print
print
Last part; Executing the program
#include <iostream>
using namespace std;
int main()
{
cout<<"Plese Entr Your Age?"<<endl;
int age;
cin>> age;
if(age>=50){
cout<<"Your age is "<< age<<" ;it is not acceptable to register for the job."<<endl;
}
else if (age>=19){
cout<<" Your age is "<< age <<" ;it is acceptable to register for the job."<<endl;
}
else{
cout<<" Your age is "<<age<< " ;you still too young to register for the job."<<endl;
}
cout<< "Thank You!";
return 0;
}
The Conclusion
I explained to you:-
• the Definition of IF STATEMENT.
• Basic If Statement Syntax.
• Operations for making condition.
• Pseudocode
• Flowchart
• Executing the program
The Reference
• http://www.cprogramming.com/tutorial/lesso
n2.html

IF Statement

  • 1.
    The student’s work:Yunis Banafi The teacher’s name: Ibrahim Aledane College's name: CTE
  • 2.
    Introduction of “Ifstatement” There are six parts: • Frist part; the Definition of IF STATEMENT. • Second part; Basic If Statement Syntax. • Third part; Operations for making condition. • Fourth part; Pseudocode • Fifth part; Flowchart • Sixth part; Executing the program
  • 3.
    First part; theDefinition of IF STATEMENT • "If statement“ It is a program uses to compare the input data with a condition; to decide what to do if the input data matches the condition or not.
  • 4.
    Second part; BasicIf Statement Syntax 1- “IF” uses with first condition that evaluates to true. 2- “Else IF” use with second condition and more that evaluates to true. 3- “Else” come after “IF” or “Else if” it use without condition and it evaluates to false.
  • 5.
    Third part; Operationsfor making condition • > greater than 5 > 4 is TRUE • < less than 4 < 5 is TRUE • >= greater than or equal 4 >= 4 is TRUE • <= less than or equal 3 <= 4 is TRUE • == equal to 5 == 5 is TRUE • != not equal to 5 != 4 is TRUE
  • 6.
    Fourth Part; Pseudocode 1-Start. 2- Enter the age. 3- calculate the age. 4- if age>50 print you are not acceptable to register for the job. 5- else if age>19 print you are acceptable to register for the job. 6- else print you are too young to register for the job. 7- End.
  • 7.
    Fifth part; Flowchart start Calculate the age Enter the age
  • 8.
    Flowchart If(age>=50) Else If(age>=19) else Y N N NY You are notacceptable to register for the job You are Acceptable to register for the job You are too young for the job to registerEnd print print print
  • 9.
    Last part; Executingthe program #include <iostream> using namespace std; int main() { cout<<"Plese Entr Your Age?"<<endl; int age; cin>> age; if(age>=50){ cout<<"Your age is "<< age<<" ;it is not acceptable to register for the job."<<endl; } else if (age>=19){ cout<<" Your age is "<< age <<" ;it is acceptable to register for the job."<<endl; } else{ cout<<" Your age is "<<age<< " ;you still too young to register for the job."<<endl; } cout<< "Thank You!"; return 0; }
  • 10.
    The Conclusion I explainedto you:- • the Definition of IF STATEMENT. • Basic If Statement Syntax. • Operations for making condition. • Pseudocode • Flowchart • Executing the program
  • 11.