View Single Post
  #2 (permalink)  
Old 06-13-2007, 03:17 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Admin
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 442
iTrader: (0)
TeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to behold
Here's my first C++ program in a few years:

Code:
#include <iostream>

using namespace std ;

int main()
{
    int level = 1;
    char suffix = '\0';    //Empty string.

    for (int counter=1;counter<11;counter++) {
        cout << counter << suffix;
        suffix = ' ';
        if ((int)((level*level + level)/2) == counter) {
            cout << endl;
            level++;
        }
    }
    return 0;
}
Tested on Visual C++ 2005.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!