------------------------------------------------------------------------------
MC logo
Array Echo
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Array Echo] [Basic Pointers] [Swap Using Pointers] [Arrays and Pointers] [Array Passing] [Integer Select Sort] [Integer Quick Sort] [Integer Library Sort] [Pointers and References]
arrecho1.cpp
/*
 * Read some integers into an array, then echo them.
 *
 * Author: Tom Bennet
 */
#include <iostream>

using namespace std;

const int ARRMAX = 100;

main()
{
        /* Read them in. */
        int arr[ARRMAX];        /* Array of numbers. */
        int sub = 0;
        while(cin >> arr[sub])
                ++sub;

        /* Print them back out again. */
        cout << "===============" << endl;
        for(int i = 0; i < sub; ++i)
                cout << arr[i] << endl;
}