Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language is C++ I have a code written that is meant to read a matrix text file and display it in rows and columns. The

Language is C++

I have a code written that is meant to read a matrix text file and display it in rows and columns. The program will read the first line of the text file which will be the dimensions of the matrix. For example:

Matrix.txt

4 8

23 54 56 6 34 65 76 87

45 78 34 23 5 78 15 43

78 32 54 3 54 15 45 34

7 6 98 34 78 3 78 23

What program should output:

23 54 56 6 34 65 76 87

45 78 34 23 5 78 15 43

78 32 54 3 54 15 45 34

7 6 98 34 78 3 78 23

My Code:

#include #include #include #include using namespace std;

int** theTable;

int main() {

int numRows = 10; int numCols = 20;

int** theTable = new int* [numRows];

string fileName; cout

ifstream fin; fin.open(fileName); if (!fin) { cout

for (int i = 0; i

for (int r = 0; r > theTable[r][c]; cout

fin.close(); }

What my program is outputting;image text in transcribed

Code Requirements:

image text in transcribed

I don't understand what I am doing wrong, so any help would be greatly appreciated

135456634657687457834235781543783254354154534769834783782300000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ress any key to close this window ... Now write a program that performs the following tasks: - Prompt the user for a file name - Accept that file name - Open the file for input (and exit if the file is not found) - Read the data in the file - Display the data as a table, in nice neat rows and columns Everything you need to know is here and in the previous dem

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

LO6Outline steps for creating a performance improvement plan.

Answered: 1 week ago

Question

CL I P COL Astro- L(1-cas0) Lsing *A=2 L sin(0/2)

Answered: 1 week ago