
Lesson 7-3: Additional Control Structures
162 | Chapter 7
Name __________________________________________ Date _______________________
Section _________________________________________
Use program Looping for Exercises 1 through 5. This program reads and sums exactly ten
integers and then reads and sums integers until a negative value is read.
// Program Looping uses a count-controlled loop to read and
// sum 10 integer values and an event-controlled loop to
// read and sum values until a negative value is found.
// The data is on file looping.dat.
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream inData;
int value;
int counter; ...