Question
The things below are from the lab template. main.cpp = #include process2DArrayHeader.h int main() { std::string filename=matrix.txt; std::ifstream inFile; char symbol = '$'; char matrix[SIZE][SIZE];
The things below are from the lab template.
main.cpp =
#include "process2DArrayHeader.h"
int main() { std::string filename="matrix.txt"; std::ifstream inFile; char symbol = '$'; char matrix[SIZE][SIZE]; bool ok=false; //open the file ok = openFile(filename, inFile); //if open successfully if (ok){ // populate the matrix fillArray(inFile,matrix); // display the matrix displayArray(matrix); //search and display location of symbol if found searchSpecialSymbol(matrix,symbol); } else std::cout
matrix.txt =
AXDW $1dq SF2X SE$z
process2DArrayFunctions =
#include "process2DArrayHeader.h" //check if file is available
bool openFile( std::string filename, std::ifstream &inFile){ inFile.open(filename); if (inFile.fail()) return false; else return true;
}
//populate the displayArray
void fillArray(std::ifstream &inFile,char matrix[SIZE][SIZE] ){ for (int row=0;row
} //read the data sets from the file void searchSpecialSymbol(char matrix[SIZE][SIZE], char symbol){ //search the two d matrix for the symbol // std::cout
process2DArrayHeader =
#include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started