Tuesday, September 9, 2014

Amazing Places on Earth

Here Are 20 Unbelievable Places You Would Swear Aren't Real... But They Are.



Wisteria Flower Tunnel - Japan

Zhangye Danxia Landform - China

Tianzi Mountains - China

Tulip Fields - Netherlands

Mount Roraima - South America

Lake Retba - Sengal

Zhangye Danxia Landform - China

Tunnel of Love - Ukraine

Mendenhall Ice Caves - Alaska

Solar du Uyuni - Bolivia

Antelope Canyon - Arizona

Bamboo Forest - China

Black Forest - Germany

Fields of Tea - China

Hang Son Doong - Vietnam

Hitachi Seaside Park - Japan

Lake Hillier - Australia

Lavender Fields - France

Naico Mine - Mexico

Red Beach - China


This is just the tip of the iceberg, there are thousands of equally unbelievable places all over the world. So get out there and start exploring the world!

Monday, September 8, 2014

Switch Statement Program

Example of a Switch Statement Program
#include <cstdlib>
#include <iostream>
using namespace std;

int main() {
int n;
cout<<"Please enter a number: ";
cin>>n;
switch (n) {
case 1: {
         cout<<"n is equal to 1! ";
         break;}
      case 2: {
         cout<<"n is equal to 2!";
         break;}
      case 3: {
         cout<<"n is equal to 3!";
         break;}
      default: {
         cout<<"n isn't equal to 1, 2, or 3.";
         break;}
   }
   system("PAUSE");
   return 0;}




Additional Example of a Switch Statement Program (For those who are asking)

#include <cstdlib>

#include <iostream>

using namespace std;

int main() {

char n;

cout<<"Please enter a letter from A to C: ";

cin>>n;

switch (n) {

case a: {

cout<<"The user of this program is a real beauty that he/she will add a comment to this post. ";

break;}

case b: {

cout<<"The user of this program is very intelligent that he/she will add a comment to this post. ";

break;}

case c: {

cout<<"The user of this program is a great person that he/she will add a comment to this post.";

break;}

default: {

cout<<"The user of this program is simply amazing!!!";

break;}

}

system("PAUSE");

return 0;}

Saturday, September 6, 2014

The Selective Structure: Switch

THE SELECTIVE STRUCTURE: SWITCH

Ø    switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via a multi-way branch.

Ø    The switch statement body consists of a series of case labels, an optional default label and breaks:

a.      Case Statement
-          the case statement is the one which compares several possible constant values for an expression
b.      Default Statement
-          the default statement is executed when no case statement satisfies the inputted value or the value being switched

c.       Break
-          break makes the program jumps to the end of the switch selective structure once one of the case statements have been satisfied


Ø  How it works:
Switch evaluates expression and checks if it is equivalent to constant1, if it is, it executes a group of statements 1 until it finds the break statement. When it finds this break statement the program jumps to the end of the switch selective structure.
If expression was not equal to constant1 it will be checked against constant2. If it is equal to this, it will execute group of statements 2 until a break keyword is found, and then will jump to the end of the switch selective structure.
Finally, if the value of expression did not match any of the previously specified constants (you can include as many case labels as values you want to check), the program will execute the statements included after the default label, if it exists (since it is optional).

Ø  Things to remember when using Switch
·         It differs from the if statement in that switch can only test for equality whereas the if conditional expression can be of any type
·         No two case constants in the same switch can have identical values
·         A switch statement is more efficient than the if-else ladder