SlideShare una empresa de Scribd logo
1 de 14
Loop example 1
                                      http://eglobiotraining.com.

#include <iostream>
using namespace std;
int main()
{
              int counter = 0; // Initialize counter to 0.
              int numTimes = 0; // Variable for user to enter the amount of times.

             cout << "How many times do you want to see Einstein?: ";
             cin >> numTimes; // This is how many times the loop repeats.

             cout << "n";

             while (counter < numTimes) // Counter is less than the users input.
             {
                          cout << "Einstein!n";
                          counter++; // Increment the counter for each loop.
             }

             cout << "n";

             return 0;
}
Screenshot
                   http://eglobiotraining.com.


/
    *===============================[outpu
    t]====================================
    How many times do you want to see
    Einstein?: 6 Einstein! Einstein! Einstein!
    Einstein! Einstein! Einstein! Press any key to
    continue . . .
    =====================================
    =====================================
    ===*/
Loop Example 2
                                                                    http://eglobiotraining.com.
#include "math.h"
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

using std::cout;
using std::endl;
using std::cin;

//mortgage class//
class Mortgage

{
        public:
        void header();
        void enterprinc();
        double princ;
        double anInt;
        int yrs;
};

//define function//

void Mortgage::header()
{

        cout << "Welcome to Smith's Amortization Calculatornn";
        cout << endl;
        cout << "Week 3 Individual Assignment C++ Mortgage Amortization Calculatornn";
        cout << endl;

}

void Mortgage::enterprinc()
{

        cout << endl;
        cout << "Enter the amount The Mortgage Amount:$";
        cin >> princ;

}
http://eglobiotraining.com.

//main function//
int main ()
{

Mortgage mortgageTotal;

    double princ = 0;
    double anInt [4]= {0, 5.35, 5.5, 5.75,};
    double yrs [4]= {0, 7, 15, 30,};
    double pmt = 0;
    double intPd = 0;
    double bal = 0;
    double amtPd = 0;
    double check(int min, int max);
    int NOP = 0;
    int Mnth = 0;
    int SL = 0;
    char indicator = ('A' ,'a','R','r','D','d');
  int select;
http://eglobiotraining.com.


//Begin Loop
{
     mortgageTotal.header ();
     mortgageTotal.enterprinc ();

             cout<< "Please Enter Your Selection!"<< endl;
             cout<< "Press A to make selection for term of mortgage and interest rate"<<endl;
             cin >> indicator;

                          if (indicator == 'A','a')
                          {

                                          cout << "Please select your Terms and Rates from the following choices: " <<
     endl;
                                          cout << "1. 7 years at 5.35%" << endl;
                                          cout << "2. 15 years at 5.5%" << endl;
                                          cout << "3. 30 years at 5.75%" << endl;
                                          cout << endl;
                                          cout << "What is your selection:";

                                                       select = 0;
                                                       cin >> select;
                                                       cout << endl << endl << endl;
                                                                      switch (select)
                          {
http://eglobiotraining.com.

case 0: cout << endl;
                                  break;
                                  case 1:
                                             yrs[2] = 7;
                                             anInt[2] = 5.35;
                                             cout << "You have selected a 7 year mortgage at 5.35% interest." << endl;
                                             break;

                                  case 2:
                                             yrs[3] = 15;
                                             anInt[3]= 5.50;
                                             cout << "You have selected 15 year mortgage at 5.50 interest%" << endl;
                                             break;

                                  case 3:
                                             yrs[4] = 30;
                                             anInt[4] = 5.75;
                                             cout << "You have selected a 30 year mortgage at 5.75% interest" << endl;
                                             break;

                                  default:
                                             cout << "Invalid Line Number" << endl;
                                             if ((select < 1)|| (select > 3))

                                             {
                                                                   system("cls");
                                                                   cout << "Your choice is invalid, please enter a valid choice!!!";
                                                                   system("PAUSE");
                                                                   system("cls");
                                                                   return main();
                                             }
                        }
                        }
http://eglobiotraining.com.



//Formulas//
double pmt = (mortgageTotal.princ*((anInt[select]/1200)/(1 - pow((1+(anInt[select]/1200)),-1*(yrs[select]*12))))); // notice the variable in the brackets
      that i added.

      cout << "Your Monthly Payment is: $" << pmt << "n";
      cout << endl;

double NOP = yrs [select] * 12;
      SL = 0;
                 for (Mnth = 1; Mnth <= NOP; ++Mnth)
                 {

      intPd = mortgageTotal.princ * (anInt[select] / 1200);
      amtPd = pmt - intPd;
      bal = mortgageTotal.princ - amtPd;
                 if (bal < 0)bal = 0;
                                      mortgageTotal.princ = bal;

                                    if (SL == 0)
                                    {
                                                      cout << "Balance of Loan" << "tttAmount of Interest Paid" << endl;
                                    }

                                                      cout << setprecision(2) << fixed << "$" << setw(5) << bal << "tttt$"<< setw(5) << intPd << endl;
                                                      ++SL;
http://eglobiotraining.com.


//Allows user to decide whether or not to continue//

      if (SL == 12)
      {
                  cout << "Would you like to continue the amoritization or quit the program?n";
                  cout << endl;
                  cout << "Enter 'R' to see the remainder or 'D' for done.n";
                  cin >> indicator;

                                  if
                                                       (indicator == 'R','r')SL = 0;

                                                                           else

                                  if

                                                       (indicator == 'D','d')
                                                       cout << endl;

      }

}

}

return 0;
}
Loop example 3
                                    http://eglobiotraining.com.
#include <iostream>
using namespace std;
int main()
{
     int number = 0; // Variable for user to enter a number.
     int sum = 0; // To hold the running sum during all loop iterations.

    cout << "Enter a number: ";
    cin >> number;

    // Loop keeps adding until it reaches the number entered.
    for (int index = 0; index <= number; index++)
    {
             sum += index; // Each iteration Adds to the variable sum.
    }

    // cout statement is put after the loop.
    cout << "nThe sum of all numbers from 0 to " << number
                       << " equals: " << sum << "nn";

    return 0;
}
Screenshot
                http://eglobiotraining.com.


*===========================[output]====
  =============================== Enter a
  number: 6 The sum of all numbers from 0 to
  6 equals: 21 Press any key to continue . . .
  =====================================
  ===================================*/
Loop example 4
                                                    http://eglobiotraining.com.
#include <iostream>
using namespace std;

int main()
{
    char selection;
    cout<<"n Menu";
    cout<<"n========";
    cout<<"n A - Append";
    cout<<"n M - Modify";
    cout<<"n D - Delete";
    cout<<"n X - Exit";
    cout<<"n Enter selection: ";
    cin>>selection;
     switch(selection)
{
    case 'A' : {cout<<"n To append a recordn";}
           break;
    case 'M' : {cout<<"n To modify a record";}
          break;
    case 'D' : {cout<<"n To delete a record";}
          break;
    case 'X' : {cout<<"n To exit the menu";}
          break;
    // other than A, M, D and X...
    default : cout<<"n Invalid selection";
    // no break in the default case
  }
  cout<<"n";
  return 0;
}
Screenshot
http://eglobiotraining.com.
Loop Example 5
                         http://eglobiotraining.com.

#include <iostream>
using namespace std;

int main ()
{

    for( ; ; )
    {
      printf("This loop will run forever.n");
    }

    return 0;
}
Submitted to:
Professor Erwin Globio
http://eglobiotraining.com/

Más contenido relacionado

La actualidad más candente

Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
Aqib Memon
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
Aqib Memon
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
Aqib Memon
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
Aqib Memon
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns project
Aayush Mittal
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
DAYANA RETO
 

La actualidad más candente (19)

INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
C programming
C programmingC programming
C programming
 
Mocking Dependencies in PHPUnit
Mocking Dependencies in PHPUnitMocking Dependencies in PHPUnit
Mocking Dependencies in PHPUnit
 
BLOOD DONATION SYSTEM IN C++
BLOOD DONATION SYSTEM IN C++BLOOD DONATION SYSTEM IN C++
BLOOD DONATION SYSTEM IN C++
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzer
 
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12THBANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
 
Atm machine using c++
Atm machine using c++Atm machine using c++
Atm machine using c++
 
Computer Science class 12
Computer Science  class 12Computer Science  class 12
Computer Science class 12
 
Window object methods (timer related)
Window object methods (timer related)Window object methods (timer related)
Window object methods (timer related)
 
12. stl örnekler
12.  stl örnekler12.  stl örnekler
12. stl örnekler
 
CSNB244 Lab5
CSNB244 Lab5CSNB244 Lab5
CSNB244 Lab5
 
Telephone billing system in c++
Telephone billing system in c++Telephone billing system in c++
Telephone billing system in c++
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns project
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
 

Similar a Powerpoint loop examples a

Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
Syed Umair
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.ppt
LokeshK66
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2
rohassanie
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++
Dendi Riadi
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik kata
haqiemisme
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
rohassanie
 

Similar a Powerpoint loop examples a (20)

Project in programming
Project in programmingProject in programming
Project in programming
 
Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
 
Lecture04
Lecture04Lecture04
Lecture04
 
ch5_additional.ppt
ch5_additional.pptch5_additional.ppt
ch5_additional.ppt
 
Penjualan swalayan
Penjualan swalayanPenjualan swalayan
Penjualan swalayan
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2
 
Tugas praktikukm pemrograman c++
Tugas praktikukm  pemrograman c++Tugas praktikukm  pemrograman c++
Tugas praktikukm pemrograman c++
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik kata
 
Ch4
Ch4Ch4
Ch4
 
Lecture16
Lecture16Lecture16
Lecture16
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
Programación
ProgramaciónProgramación
Programación
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
 
Programa Sumar y Multiplicar
Programa Sumar y MultiplicarPrograma Sumar y Multiplicar
Programa Sumar y Multiplicar
 
Contoh program c++ kalkulator
Contoh program c++ kalkulatorContoh program c++ kalkulator
Contoh program c++ kalkulator
 
4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf
 
Computer Science Project on Management System
Computer Science Project on Management System Computer Science Project on Management System
Computer Science Project on Management System
 
goto dengan C++
goto dengan C++goto dengan C++
goto dengan C++
 
JavaScript Control Statements II
JavaScript Control Statements IIJavaScript Control Statements II
JavaScript Control Statements II
 
Output in c++ (cout)
Output in c++ (cout)Output in c++ (cout)
Output in c++ (cout)
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

Powerpoint loop examples a

  • 1. Loop example 1 http://eglobiotraining.com. #include <iostream> using namespace std; int main() { int counter = 0; // Initialize counter to 0. int numTimes = 0; // Variable for user to enter the amount of times. cout << "How many times do you want to see Einstein?: "; cin >> numTimes; // This is how many times the loop repeats. cout << "n"; while (counter < numTimes) // Counter is less than the users input. { cout << "Einstein!n"; counter++; // Increment the counter for each loop. } cout << "n"; return 0; }
  • 2. Screenshot http://eglobiotraining.com. / *===============================[outpu t]==================================== How many times do you want to see Einstein?: 6 Einstein! Einstein! Einstein! Einstein! Einstein! Einstein! Press any key to continue . . . ===================================== ===================================== ===*/
  • 3. Loop Example 2 http://eglobiotraining.com. #include "math.h" #include <iostream> #include <cmath> #include <iomanip> using namespace std; using std::cout; using std::endl; using std::cin; //mortgage class// class Mortgage { public: void header(); void enterprinc(); double princ; double anInt; int yrs; }; //define function// void Mortgage::header() { cout << "Welcome to Smith's Amortization Calculatornn"; cout << endl; cout << "Week 3 Individual Assignment C++ Mortgage Amortization Calculatornn"; cout << endl; } void Mortgage::enterprinc() { cout << endl; cout << "Enter the amount The Mortgage Amount:$"; cin >> princ; }
  • 4. http://eglobiotraining.com. //main function// int main () { Mortgage mortgageTotal; double princ = 0; double anInt [4]= {0, 5.35, 5.5, 5.75,}; double yrs [4]= {0, 7, 15, 30,}; double pmt = 0; double intPd = 0; double bal = 0; double amtPd = 0; double check(int min, int max); int NOP = 0; int Mnth = 0; int SL = 0; char indicator = ('A' ,'a','R','r','D','d'); int select;
  • 5. http://eglobiotraining.com. //Begin Loop { mortgageTotal.header (); mortgageTotal.enterprinc (); cout<< "Please Enter Your Selection!"<< endl; cout<< "Press A to make selection for term of mortgage and interest rate"<<endl; cin >> indicator; if (indicator == 'A','a') { cout << "Please select your Terms and Rates from the following choices: " << endl; cout << "1. 7 years at 5.35%" << endl; cout << "2. 15 years at 5.5%" << endl; cout << "3. 30 years at 5.75%" << endl; cout << endl; cout << "What is your selection:"; select = 0; cin >> select; cout << endl << endl << endl; switch (select) {
  • 6. http://eglobiotraining.com. case 0: cout << endl; break; case 1: yrs[2] = 7; anInt[2] = 5.35; cout << "You have selected a 7 year mortgage at 5.35% interest." << endl; break; case 2: yrs[3] = 15; anInt[3]= 5.50; cout << "You have selected 15 year mortgage at 5.50 interest%" << endl; break; case 3: yrs[4] = 30; anInt[4] = 5.75; cout << "You have selected a 30 year mortgage at 5.75% interest" << endl; break; default: cout << "Invalid Line Number" << endl; if ((select < 1)|| (select > 3)) { system("cls"); cout << "Your choice is invalid, please enter a valid choice!!!"; system("PAUSE"); system("cls"); return main(); } } }
  • 7. http://eglobiotraining.com. //Formulas// double pmt = (mortgageTotal.princ*((anInt[select]/1200)/(1 - pow((1+(anInt[select]/1200)),-1*(yrs[select]*12))))); // notice the variable in the brackets that i added. cout << "Your Monthly Payment is: $" << pmt << "n"; cout << endl; double NOP = yrs [select] * 12; SL = 0; for (Mnth = 1; Mnth <= NOP; ++Mnth) { intPd = mortgageTotal.princ * (anInt[select] / 1200); amtPd = pmt - intPd; bal = mortgageTotal.princ - amtPd; if (bal < 0)bal = 0; mortgageTotal.princ = bal; if (SL == 0) { cout << "Balance of Loan" << "tttAmount of Interest Paid" << endl; } cout << setprecision(2) << fixed << "$" << setw(5) << bal << "tttt$"<< setw(5) << intPd << endl; ++SL;
  • 8. http://eglobiotraining.com. //Allows user to decide whether or not to continue// if (SL == 12) { cout << "Would you like to continue the amoritization or quit the program?n"; cout << endl; cout << "Enter 'R' to see the remainder or 'D' for done.n"; cin >> indicator; if (indicator == 'R','r')SL = 0; else if (indicator == 'D','d') cout << endl; } } } return 0; }
  • 9. Loop example 3 http://eglobiotraining.com. #include <iostream> using namespace std; int main() { int number = 0; // Variable for user to enter a number. int sum = 0; // To hold the running sum during all loop iterations. cout << "Enter a number: "; cin >> number; // Loop keeps adding until it reaches the number entered. for (int index = 0; index <= number; index++) { sum += index; // Each iteration Adds to the variable sum. } // cout statement is put after the loop. cout << "nThe sum of all numbers from 0 to " << number << " equals: " << sum << "nn"; return 0; }
  • 10. Screenshot http://eglobiotraining.com. *===========================[output]==== =============================== Enter a number: 6 The sum of all numbers from 0 to 6 equals: 21 Press any key to continue . . . ===================================== ===================================*/
  • 11. Loop example 4 http://eglobiotraining.com. #include <iostream> using namespace std; int main() { char selection; cout<<"n Menu"; cout<<"n========"; cout<<"n A - Append"; cout<<"n M - Modify"; cout<<"n D - Delete"; cout<<"n X - Exit"; cout<<"n Enter selection: "; cin>>selection; switch(selection) { case 'A' : {cout<<"n To append a recordn";} break; case 'M' : {cout<<"n To modify a record";} break; case 'D' : {cout<<"n To delete a record";} break; case 'X' : {cout<<"n To exit the menu";} break; // other than A, M, D and X... default : cout<<"n Invalid selection"; // no break in the default case } cout<<"n"; return 0; }
  • 13. Loop Example 5 http://eglobiotraining.com. #include <iostream> using namespace std; int main () { for( ; ; ) { printf("This loop will run forever.n"); } return 0; }
  • 14. Submitted to: Professor Erwin Globio http://eglobiotraining.com/