SlideShare a Scribd company logo
1 of 13
Switch example 1
                                          http://eglobiotraining.com.
#include <iostream>
using namespace std;
int main(void)
{
  char grade;
  cout << "Enter your grade: ";
  cin >> grade;
  switch (grade)
  {
  case 'a':case 'A':
    cout << "Your average must be between 90 - 100"
       << endl;
    break;
  case 'b':
  case 'B':
    cout << "Your average must be between 80 - 89"
       << endl;
    break;
  case 'c':
  case 'C':
    cout << "Your average must be between 70 - 79"
       << endl;
    break;
  case 'd':
  case 'D':
    cout << "Your average must be between 60 - 69"
       << endl;
    break;
  default:
    cout << "Your average must be below 60" << endl;
  }
return 0;
}
Screenshot
                  http://eglobiotraining.com




Enter your grade: 1
Your average must be below 60
Switch example 2
•   #include <iostream>                                                     http://eglobiotraining.com
•   using namespace std;
•   int main()
•   {
•                 int choice;

•                 cout << "MENUnn";

•                 cout << "1." << "t" << "Lobstern";
•                 cout << "2." << "t" << "Steakn";
•                 cout << "3." << "t" << "Turkeyn";
•                 cout << "4." << "t" << "Hambergern";
•                 cout << "5." << "t" << "Vegetariannn";

•                 cout << "Choose your dinner entree: ";
•                 cin >> choice;

•                 cout << endl;

•                 switch (choice)
•                 {
•                 case 1: cout << "Lobster is my favorite! Dig in!nn";
•                                       break;

•                 case 2: cout << "Yummy! Steak is great...n"
•                                         << "but limit yourself to once a week," << endl
•                                         << "or risk the chance of high cholesterol!nn";
•                                      break;

•                 case 3: cout << "Turkey is healthier than steak! ...Enjoy!nn";
•                                       break;

•                 case 4: cout << "Hamburger is another form of steak. :-)nn";
•                                      break;

•                 case 5: cout << "Finally, a vegitarian is in the house!nn";
•                                        break;

•                 default: cout << "Invalid number, please enter a number"
•                                            << " from the entrees above.nn";
•                                        break;
•                 }
•                 return 0;
•   }
Screenshot
                 http://eglobiotraining.com




MENU 1. Lobster 2. Steak 3. Turkey 4.
 Hamberger 5. Vegetarian Choose your dinner
 entree: 2 Yummy! Steak is great... but limit
 yourself to once a week, or risk the chance of
 high cholesterol!
Switch example 3
                                                               http://eglobiotraining.com


#include <iostream>
using namespace std;
int main()
{
       char letter;

      cout << "A)tHouse MDn"
        << "B)tAmerican Idlen"
        << "C)tFamily Guynn";

      cout << "What TV show do you like (Enter A, B, C)?: ";

      cin >> letter;

      cout << endl;

      switch (toupper(letter))
      {
      case 'A' : cout << "Dr. House is a radical doctor!nn";
                   break;
      case 'B' : cout << "Wannabe singers!nn";
                   break;
      case 'C' : cout << "One of the craziest cartoons Ive ever seen.nn";
                   break;
      default: cout << "Invalid choice.nn";
                   break;
      }
      return 0;
}
Screenshot
                      http://eglobiotraining.com

/
    *============================[output]========
    ========================= A) House MD B)
    American Idle C) Family Guy What TV show do you like
    (Enter A, B, C)?: a Dr. House is a radical doctor! Press
    any key to continue . . .
    =============================[output
    2]================================ A) House
    MD B) American Idle C) Family Guy What TV show do
    you like (Enter A, B, C)?: z Invalid choice. Press any key
    to continue . . .
    ============================================
    ==========================*/
Switch example 4
                                                                       http://eglobiotraining.com
#include <iostream>
using namespace std;
int main()
{
        int num;

       cout << "MENUnn";
       cout << "1." << "t" << "Lobstern";
       cout << "2." << "t" << "Steakn";
       cout << "3." << "t" << "Turkeyn";
       cout << "4." << "t" << "Hambergern";
       cout << "5." << "t" << "Vegetariannn";
       cout << "Choose your dinner entree: ";
       cin >> num;

       cout << endl;

       if (num == 1)
                       {
                           cout << "Lobster is my favorite! Dig in!nn";
                       }

                       else if (num == 2)
                       {
                         cout << "Yummy! Steak is great...n"
                            << "but limit yourself to once a week,n"
                            << "or risk the chance of high cholesterol!nn";
                       }

                       else if (num == 3)
                       {
                         cout << "Turkey is healthier than steak! ...Enjoy!nn";
                       }

                       else if (num == 4)
                       {
                         cout << "Hamburger is another form of steak. :-)nn";
                       }

                       else if (num == 5)
                       {
                         cout << "Finally, a vegitarian is in the house!nn";
                       }

                       else
                       {
                         cout << "Invalid number, please enter a number"
                            << " from the entrees above.nn";
                       }
Screenshot
                     http://eglobiotraining.com

/
    *=====================[output]================
    ======================= MENU 1. Lobster 2. Steak
    3. Turkey 4. Hamberger 5. Vegetarian Choose your
    dinner entree: 5 Finally, a vegitarian is in the house!
    Press any key to continue . . .
    ============================[output
    2]================================ MENU 1.
    Lobster 2. Steak 3. Turkey 4. Hamberger 5. Vegetarian
    Choose your dinner entree: 0 Invalid number, please
    enter a number from the entrees above. Press any key
    to continue . . .
    =============================================
    =========================*/
Switch Example 5
                                                  http://eglobiotraining.com



#include <stdlib.h>
#include <stdio.h>

int main(void) {
  int n;
  printf("Please enter a number: ");
  scanf("%d", &n);
  switch (n) {
    case 1: {
      printf("n is equal to 1!n");
      break;
    }
    case 2: {
      printf("n is equal to 2!n");
      break;
    }
    case 3: {
      printf("n is equal to 3!n");
      break;
    }
    default: {
      printf("n isn't equal to 1, 2, or 3.n");
      break;
    }
  }
  system("PAUSE");
  return 0;
}
Screenshot
http://eglobiotraining.com
http://eglobiotraining.com
http://eglobiotraining.com
Submitted to:
Professor Erwin Globio
http://eglobiotraining.com/

More Related Content

Viewers also liked

Ramon cabanillas
Ramon cabanillasRamon cabanillas
Ramon cabanillasMGLR
 
Ro flyer 10_blaetterkatalog_150
Ro flyer 10_blaetterkatalog_150Ro flyer 10_blaetterkatalog_150
Ro flyer 10_blaetterkatalog_150kogi1983
 
Pembangunan Pertanian
Pembangunan PertanianPembangunan Pertanian
Pembangunan PertanianU_Ucek
 
ユーザー体験設計を軸にすすめるサービスデザイン
ユーザー体験設計を軸にすすめるサービスデザインユーザー体験設計を軸にすすめるサービスデザイン
ユーザー体験設計を軸にすすめるサービスデザインNoriteru Ino
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples ajaypeebala
 
Curriculum
CurriculumCurriculum
CurriculumAjay Pj
 
Persamaan dan rumus kimia (ii)
Persamaan dan rumus kimia (ii)Persamaan dan rumus kimia (ii)
Persamaan dan rumus kimia (ii)ulil_albab
 
Strategic management project (1)
Strategic management project (1)Strategic management project (1)
Strategic management project (1)Harshit Kansal
 
Undang undang & anda
Undang undang & andaUndang undang & anda
Undang undang & andanabilahbell
 

Viewers also liked (10)

Ramon cabanillas
Ramon cabanillasRamon cabanillas
Ramon cabanillas
 
Ro flyer 10_blaetterkatalog_150
Ro flyer 10_blaetterkatalog_150Ro flyer 10_blaetterkatalog_150
Ro flyer 10_blaetterkatalog_150
 
Pembangunan Pertanian
Pembangunan PertanianPembangunan Pertanian
Pembangunan Pertanian
 
ユーザー体験設計を軸にすすめるサービスデザイン
ユーザー体験設計を軸にすすめるサービスデザインユーザー体験設計を軸にすすめるサービスデザイン
ユーザー体験設計を軸にすすめるサービスデザイン
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples a
 
Curriculum
CurriculumCurriculum
Curriculum
 
Persamaan dan rumus kimia (ii)
Persamaan dan rumus kimia (ii)Persamaan dan rumus kimia (ii)
Persamaan dan rumus kimia (ii)
 
Strategic management project (1)
Strategic management project (1)Strategic management project (1)
Strategic management project (1)
 
Accident
AccidentAccident
Accident
 
Undang undang & anda
Undang undang & andaUndang undang & anda
Undang undang & anda
 

Similar to Powerpoint switch1

Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentesmfuentessss
 
Programa de Detección de Valor de una Resistencia de Carbón en C++
Programa de Detección de Valor de una Resistencia de Carbón en C++Programa de Detección de Valor de una Resistencia de Carbón en C++
Programa de Detección de Valor de una Resistencia de Carbón en C++Ramon Lop-Mi
 

Similar to Powerpoint switch1 (8)

Ramirez slideshow
Ramirez slideshowRamirez slideshow
Ramirez slideshow
 
Lab # 3
Lab # 3Lab # 3
Lab # 3
 
Project in programming
Project in programmingProject in programming
Project in programming
 
Algoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.lAlgoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.l
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
 
Ch4
Ch4Ch4
Ch4
 
Programa de Detección de Valor de una Resistencia de Carbón en C++
Programa de Detección de Valor de una Resistencia de Carbón en C++Programa de Detección de Valor de una Resistencia de Carbón en C++
Programa de Detección de Valor de una Resistencia de Carbón en C++
 

Recently uploaded

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Recently uploaded (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Powerpoint switch1

  • 1. Switch example 1 http://eglobiotraining.com. #include <iostream> using namespace std; int main(void) { char grade; cout << "Enter your grade: "; cin >> grade; switch (grade) { case 'a':case 'A': cout << "Your average must be between 90 - 100" << endl; break; case 'b': case 'B': cout << "Your average must be between 80 - 89" << endl; break; case 'c': case 'C': cout << "Your average must be between 70 - 79" << endl; break; case 'd': case 'D': cout << "Your average must be between 60 - 69" << endl; break; default: cout << "Your average must be below 60" << endl; } return 0; }
  • 2. Screenshot http://eglobiotraining.com Enter your grade: 1 Your average must be below 60
  • 3. Switch example 2 • #include <iostream> http://eglobiotraining.com • using namespace std; • int main() • { • int choice; • cout << "MENUnn"; • cout << "1." << "t" << "Lobstern"; • cout << "2." << "t" << "Steakn"; • cout << "3." << "t" << "Turkeyn"; • cout << "4." << "t" << "Hambergern"; • cout << "5." << "t" << "Vegetariannn"; • cout << "Choose your dinner entree: "; • cin >> choice; • cout << endl; • switch (choice) • { • case 1: cout << "Lobster is my favorite! Dig in!nn"; • break; • case 2: cout << "Yummy! Steak is great...n" • << "but limit yourself to once a week," << endl • << "or risk the chance of high cholesterol!nn"; • break; • case 3: cout << "Turkey is healthier than steak! ...Enjoy!nn"; • break; • case 4: cout << "Hamburger is another form of steak. :-)nn"; • break; • case 5: cout << "Finally, a vegitarian is in the house!nn"; • break; • default: cout << "Invalid number, please enter a number" • << " from the entrees above.nn"; • break; • } • return 0; • }
  • 4. Screenshot http://eglobiotraining.com MENU 1. Lobster 2. Steak 3. Turkey 4. Hamberger 5. Vegetarian Choose your dinner entree: 2 Yummy! Steak is great... but limit yourself to once a week, or risk the chance of high cholesterol!
  • 5. Switch example 3 http://eglobiotraining.com #include <iostream> using namespace std; int main() { char letter; cout << "A)tHouse MDn" << "B)tAmerican Idlen" << "C)tFamily Guynn"; cout << "What TV show do you like (Enter A, B, C)?: "; cin >> letter; cout << endl; switch (toupper(letter)) { case 'A' : cout << "Dr. House is a radical doctor!nn"; break; case 'B' : cout << "Wannabe singers!nn"; break; case 'C' : cout << "One of the craziest cartoons Ive ever seen.nn"; break; default: cout << "Invalid choice.nn"; break; } return 0; }
  • 6. Screenshot http://eglobiotraining.com / *============================[output]======== ========================= A) House MD B) American Idle C) Family Guy What TV show do you like (Enter A, B, C)?: a Dr. House is a radical doctor! Press any key to continue . . . =============================[output 2]================================ A) House MD B) American Idle C) Family Guy What TV show do you like (Enter A, B, C)?: z Invalid choice. Press any key to continue . . . ============================================ ==========================*/
  • 7. Switch example 4 http://eglobiotraining.com #include <iostream> using namespace std; int main() { int num; cout << "MENUnn"; cout << "1." << "t" << "Lobstern"; cout << "2." << "t" << "Steakn"; cout << "3." << "t" << "Turkeyn"; cout << "4." << "t" << "Hambergern"; cout << "5." << "t" << "Vegetariannn"; cout << "Choose your dinner entree: "; cin >> num; cout << endl; if (num == 1) { cout << "Lobster is my favorite! Dig in!nn"; } else if (num == 2) { cout << "Yummy! Steak is great...n" << "but limit yourself to once a week,n" << "or risk the chance of high cholesterol!nn"; } else if (num == 3) { cout << "Turkey is healthier than steak! ...Enjoy!nn"; } else if (num == 4) { cout << "Hamburger is another form of steak. :-)nn"; } else if (num == 5) { cout << "Finally, a vegitarian is in the house!nn"; } else { cout << "Invalid number, please enter a number" << " from the entrees above.nn"; }
  • 8. Screenshot http://eglobiotraining.com / *=====================[output]================ ======================= MENU 1. Lobster 2. Steak 3. Turkey 4. Hamberger 5. Vegetarian Choose your dinner entree: 5 Finally, a vegitarian is in the house! Press any key to continue . . . ============================[output 2]================================ MENU 1. Lobster 2. Steak 3. Turkey 4. Hamberger 5. Vegetarian Choose your dinner entree: 0 Invalid number, please enter a number from the entrees above. Press any key to continue . . . ============================================= =========================*/
  • 9. Switch Example 5 http://eglobiotraining.com #include <stdlib.h> #include <stdio.h> int main(void) { int n; printf("Please enter a number: "); scanf("%d", &n); switch (n) { case 1: { printf("n is equal to 1!n"); break; } case 2: { printf("n is equal to 2!n"); break; } case 3: { printf("n is equal to 3!n"); break; } default: { printf("n isn't equal to 1, 2, or 3.n"); break; } } system("PAUSE"); return 0; }
  • 13. Submitted to: Professor Erwin Globio http://eglobiotraining.com/