Simple If – Senior Citizen Test – CSKC
Sign In

Search

Code Learning #CPP#1854    siteicon   siteicon  

Simple If – Senior Citizen Test

Taking age as input and finding if it is greater or equal to 60.

Learning Objectives

  • Learning to make a selection of instructions to be executed when certain condition given after the if is true.
  • Only the instruction after the the condition is true is done here.

Source Code

TC++ #1854

 

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

int age;ย cout<<“Give your age :”;ย cin>>age;
Collecting the age of person as an integer variable.

if(age >=60)
Testing if the age is more or equal to 60. This is an incomplete instruction as an if instruction is completed by its statement of truthness immediately following it or within curly braces block after it.

cout<<“You are a senior citizen”<<endl;
Printing the message for a senior citizen. This is the statement which is followed when condition given after the if is true.

Notes

  • Concept of age for a senior citizen to be 60 may be different in different countries or schemes there off.

 


Suggested Filename(s): simpleif.cpp, seniorcitizen.cpp



Share

Created: 22-Dec-2017 01:15 | Updated: 15-Sep-2018 11:02|