reverse - else FILL IN Code to read value FILL IN Code to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Program Reverse reads numbers into an array // and prints them out in reverse order. / #include <iostream> #include <fstream> using namespace std; u const int MAX = 10; c int main () { int numbers[MAX]; ifstream inData; int index; int sum =0; inData.open("E:\\BackUp\\SkolStuffs\\U.C.C\\CSC\\Lab13\\reverse.dat"); for (index = 0; index < MAX; index++) { if (!inData) cout << "File cannot be opened"<<endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else // FILL IN Code to read value // FILL IN Code to store value into numbers inData >> numbers[index]; } for (index = MAX - 1; index >= 0; index--) cout << numbers[index] << endl;// FILL IN Code to write numbers on the screen for (index = 0; index < MAX; index++) sum = sum + numbers[index]; cout << "Sum is " << sum << endl; return 0; }...
View Full Document

This note was uploaded on 02/08/2011 for the course CSC 101 taught by Professor Joedzuback during the Spring '11 term at Union County.

Ask a homework question - tutors are online