Question: main.cpp #include #include #include functions.h using namespace std; // Normally you should not use global variables. However, the stack is // limited in size and

main.cpp

#include #include #include "functions.h" using namespace std;

// Normally you should not use global variables. However, the stack is // limited in size and will not allow arrays of this size. We'll learn // later how to put these arrays on the heap instead. Regardless, for now // we'll use these and treat them as if they were declared in main. So // when used in functions, we'll pass them as we would any other array. static int elevations[MAX_ROWS][MAX_COLS]; static Pixel image[MAX_ROWS][MAX_COLS];

int main() { }

functions.h

#ifndef FUNCTIONS_H #define FUNCTIONS_H

// Do not add using namespace

#include

const int MAX_ROWS = 1000; const int MAX_COLS = 1000;

struct Pixel { int red; int green; int blue; };

void findMaxMin(const int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, int& max, int& min); void loadData(int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, std::istream& inData); void loadGreyscale(Pixel image[MAX_ROWS][MAX_COLS], const int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, int max, int min); void outputImage(const Pixel image[MAX_ROWS][MAX_COLS], int rows, int cols, std::ostream& outData); int scaleValue(int value, int max, int min);

#endif

functions cpp

#include #include #include #include "functions.h" using namespace std;

void findMaxMin(const int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, int& max, int& min) { }

void loadData(int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, istream& inData) { }

int scaleValue(int value, int max, int min) { return 255; }

void loadGreyscale(Pixel image[MAX_ROWS][MAX_COLS], const int elevations[MAX_ROWS][MAX_COLS], int rows, int cols, int max, int min) }

void outputImage(const Pixel image[MAX_ROWS][MAX_COLS], int rows, int cols, ostream& outData) { }

See link for further details: https://docs.google.com/document/d/1fFLphEDH3NU55-ekMIyHdT9Qhj0y6TQQmX1RuB27RV0/edit or go to http://people.tamu.edu/~michael.nowak/teach/fl18.csce121/ and select 'Mountains Paths Part 1'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!