Electrical and Computer Engineering
28 of 30
UAH
CPE 112
Case Study: Implementation
•     dataFile >> deptID;
•    if ( !dataFile )         // Check for EOF
•        return 1;            // If so, exit the function
•
•    dataFile >> numDays;
•    deptSales = 0.0;
•    day = 1;          // Initialize loop control variable
•    while (day <= numDays)
•    {
•        dataFile >> sale;
•        deptSales = deptSales + sale;
•        day++;            // Update loop control variable
•    }
•}