#mastery16

2 min read

Hello class, I have done this activity wich is very usefull, in this activity we used if´s but we use “else´s” too, what is this?, well, as we have seen “if” is a conditional, if something happen the program do something, but what about if the “if” is false? well, in this case we use “else”, so this work like this: If something is true do this: { – – – – – },    else (If it was false) do this: { – – – – }.

So as we could see else will do some instructions because the first parte was false, what I did in my program was this:

 

I asked for the age of a person, and do ranges with the ages ( 0 – 16, 17 – 30,  31 and + ); for example, if the age was 5 years, the programan say oh you are a kid, but what happen if the age were 25? well here is where the “else” works, if it is not in the range of 0 – 16, this will happen, and we can do this proccess all the time we want, it is really it is usefull.

 

Here is my program:

https://www.dropbox.com/s/t6qpkpw4v4kfzhj/mastery16.cpp?dl=0

 

CC BY 4.0 #mastery16 by Osvaldo Mendoza is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.