Integer Limit


Program Listing

IntLimit.cpp

/************************************************************************
*                                                                       *
*   Program:    Int Limit                                               *
*                                                                       *
************************************************************************/

#include <iostream>
#include <string>

using namespace std;

int main() {

    int i = 1;
    cout << i << endl;      // Print 1
    i = 10 * i;
    cout << i << endl;      // Print 10
    i = 10 * i;
    cout << i << endl;      // Print 100
    i = 10 * i;
    cout << i << endl;      // Print 1000
    i = 10 * i;
    cout << i << endl;      // Print 10^4
    i = 10 * i;
    cout << i << endl;      // Print 10^5
    i = 10 * i;
    cout << i << endl;      // Print 10^6
    i = 10 * i;
    cout << i << endl;      // Print 10^7
    i = 10 * i;
    cout << i << endl;      // Print 10^8
    i = 10 * i;
    cout << i << endl;      // Print 10^9
    i = 10 * i;
    cout << i << endl;      // Print 10^10
    i = 10 * i;
    cout << i << endl;      // Print 10^11
    i = 10 * i;
    cout << i << endl;      // Print 10^12
    i = 10 * i;
    cout << i << endl;      // Print 10^13
    
    return 0;
}

Sample Run

1
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
1410065408
1215752192
-727379968
1316134912



Return to Lectures page


e-mail me at robbk@hsc.edu

This page was last modified on Tue Dec 7 16:04:22 1999 .

URL: http://people.hsc.edu/faculty-staff/robbk/Coms261/Examples/IntLimit.html

Return to Coms 261 home page