Prints the alphabet with a simple for loop. - C++ Statement

C++ examples for Statement:for

Description

Prints the alphabet with a simple for loop.

Demo Code

#include <iostream>
using namespace std;
int main()/*from  w w w . j  ava 2 s . c  o m*/
{
   char letter;
   cout << "Here is the alphabet:\n";
   for (letter='A'; letter<='Z'; letter++) // Loops A to Z
   {
      cout << " " << letter;
   }
   return 0;
}

Result


Related Tutorials