9. Given the following C++ program, write a simple program that traverses the source file line by line and shows the con
Posted: Fri May 20, 2022 12:20 pm
9. Given the following C++ program, write a simple program that traverses the source file line by line and shows the content of the symbol table using static scoping rules. Make sure you pause your output from line to line so that the symbol table may be viewed properly. Your input should be from a source file called input.txt. (20 points) #include <iostream> #include <stdlib.h> using namespace std; int absolute (int x) { if (x<0) return x; else return x; int main() { int magic; int guess; // magic number // user's guess magic = rand(); // get a random number magic = absolute (magic); cout << "Enter your positive number guess: cin >> guess; "; if (guess == magic) // Notice the "==" operator, which compares two values. cout << "** Right **"; cout << "The magic number was: << magic << endl; return 0; 11