Question: I need help with these exercises. language is C++. Read program Scope carefully and then complete Exercises 1-4 (Hint: parameters are also local variables to

I need help with these exercises. language is C++.

I need help with these exercises. language is C++. Read program Scope

carefully and then complete Exercises 1-4 (Hint: parameters are also local variables

Read program Scope carefully and then complete Exercises 1-4 (Hint: parameters are also local variables to a function.) 7 Program Scope demonstrates scope rules and lifetime #include #include using namespace std; int counter; int sum = 0; int number; ifstream inNums; void SumNumbers (ifstream&inFile, int& answer); Sums the numbers on inFile int main inNums.open ("numeric.dat") int sum = 0; SumNumbers (inNums, sum) cout >number; answer-answer + number; counter++ Exercise 1: File numeric.dat contains the following values: 10 20 30 40 10 -20 30 -40. Without running the program, answer the following question: what will be printed? Now run the program, does it verify your expectation? Explain why the two outputs are the same Exercise 2: List the global variables. Exercise 3: List the local variables and state the functions (or blocks) in which each is accessible. Exercise 4: List the automatic local variables and the static local variables

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!