1.1 Nested Loops – Lab3C.cpp Loops often have loops inside them. These are called “nested” loops. In this exercise you will finish a nested loop that reads lines of numbers from a file and computes and prints out the sum of each line. //C++ Lab3C.cpp // <Your Name> // <Your Section> // <Your student id> //1. [include required header files]// using namespace std; int main() { [2. Declare required variables] try { //3> put your file name & Open file as an input mode ifstream Openfile(" “); //4> If file doesn't exist then throw error number if(Openfile.good()) { while( getline(Openfile, sLine)) //Outer While Loop Condition { cout << "The Contents of line sLine" << sLine << "\n"; stringstream Str(sLine); while (Str >> temp ) //Inner While Loop Condition { cout << "String ~to double" << temp; }// Inner while Loop } //Outer While Loop Openfile.close(); //3> Catch the error number and display message } else { throw 10; } } //if catch(int e) { cout << "File Not found " << e << endl; } //system("pause"); //Pause return 0; }//main 1.2 Once you have completed the program, run it on the input file below: Lab4C.in 10 20 30 40 50 60 70 80 90.0 11 13.0 20 40 70 19.0 Lab4C.out or Lab4C.doc with screen shot Read Line 0 10.0 Sum 10.0 Read Line 0 20.0 Sum 30.0 Read Line 0 30.0 Sum 60.0 Read Line 0 40.0 Sum 100.0 Read Line 0 50.0 Sum 150.0 ….. Read Line 3 20.0 Sum 20.0 Read Line 3 40.0 Sum 60.0 Read Line 3 70.0 Sum 130.0 Read Line 3 19.0 Sum 149.0 1.3 Upload your four files (Lab3A.cpp, Lab3B.cpp, Lab3C.cpp and Lab3C.doc) as one single zip file named “Lab3ABC.zip”) 2. Lab3D – Two Dimensional Arrays 2.1 Declaring 2D arrays In C++, to make a 2D array, we simply declare an array where the type is an array. To see how this works, first look at how we create an int array with 10 elements. One might type int arr1D[ 10] ; What the above code actually does is create a new “int Array” that reserves enough space to store 10 integers. For creating a 2D arrays, we can make an array of them, by appending another set of square brackets: int arr2D[3][7]; This declares a two dimensional array of ints with 3 rows and 7 columns. By convention, we think of the array as being indexed in “Row Major Order”, which means that the row (y value) comes before the column (x value). Thus, visually, the array looks like this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The top left element is at position [0][0], and the bottom right element is at position [2][6]. The array elements are initialized just as in the 1D case ( Numerics are set to 0, and object types are set to null). To access one of the elements of a 2D array, we use double bracket notation again, so we can write arr2D[0][1] = 1; arr2D[2][3] = 4; This would give us the array: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 If.