Menu

[Solved]Included Project Perfect Square Table Perfect Square Table Square Positive Integers Sum Ro Q37229745

Project: Perfect Square Table (Figure 1) Figure 1 shows a number square table. A Perfect Square Table is a square of positi

INCLUDED:

Project: Perfect Square Table
   A “Perfect Square Table” is a square of positiveintegers such that the
   sum of each row, column, and diagonal is the sameconstant.
   This program reads square tables from files, checks ifthey are perfect squares,
   and displays messages such as “This is a PerfectSquare Table with a constant of 34!”
   or “This is not a Perfect Square Table”.

   NAME:
   IDE:

   */

   #include <iostream>

   using namespace std;

   const int MAXTBLSIZE = 100; // the maximum tablesize is 100

   int main( void )
   {
       string fileName[] = {“T0.txt”,”T1.txt”, “T2.txt”, “TA.txt”, “T3.txt”, “T4.txt”, “T5.txt”,”T6.txt”, “T7.txt”, “”};
       int table[MAXTBLSIZE][MAXTBLSIZE] ={0};
       inttblSize;     // the number of rows andcolumns
       int tblConstant; // -1 if it is nota perfect table or the table’s constant otherwise
       int choice = 1; // to stop theprogram to allow the user to see the results one table at atime
  
       // test loop: takes the names of 7input files from an array
       for (int i = 0; choice == 1&& fileName[i] != “”; i++)
       {
           if(readTable(fileName[i], table, tblSize))
           {
              tblConstant = testTable(table, tblSize);
              printTable(table, tblSize);
              printResults(tblConstant);
           }
           else
           {
              cout << “Error: Input file “” <<fileName[i] << “” not found!” << endl;
           }
      
           cout <<“Please enter 1 to continue 0 to stop” << endl;
           cin >>choice;
       }
  
       return 0;
   }   // main

   /** Save the output below

   */

Project: Perfect Square Table (Figure 1) Figure 1 shows a number square table. A “Perfect Square Table” is a square of positive integers such that the sum of each row, column, and diagonal is the same constant. For example, the square table in Figure 1 is a Perfect Square Table with a constant of 34. Write a program that determines if a square table is a Perfect Square Table. The number of rows in the table is>1 but< 100. The numbers in the table, all integers, are between 0 and 1002 16 3 2 13 5 10 11 8 9 6712 4 15 141 Input Data: Data about the number of rows and columns in the table are first read from the input tile. In our example, the input tile appears as tollows // This square table has 4 rows and columns 16 3 2 13 5 10 11 8 9 6 7 12 4 15 14 1 Output Data: Display the table as shown below if and only if the number of rows8 Square Table Size: 4 161 31 2 13 1 51 101 11 8I 1 91 61 71 12 1 41 151 14 11 Then display a message such as “This is a Perfect Square Table with a constant of 34!” or “This is not a Perfect Square Table Algorithm – will be discussed in class Show transcribed image text Project: Perfect Square Table (Figure 1) Figure 1 shows a number square table. A “Perfect Square Table” is a square of positive integers such that the sum of each row, column, and diagonal is the same constant. For example, the square table in Figure 1 is a Perfect Square Table with a constant of 34. Write a program that determines if a square table is a Perfect Square Table. The number of rows in the table is>1 but

Expert Answer


Answer to INCLUDED: Project: Perfect Square Table A “Perfect Square Table” is a square of positive integers such that the sum … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *