Write a function floodMap(...) which takes three arguments, a two dimensional ar
ID: 3722630 • Letter: W
Question
Write a function floodMap(...) which takes three arguments, a two dimensional array of doubles indicating the height of the terrain at a particular point in space (assume that there are 4 columns), an int indicating the number of rows in the map, and a double indicating the current water level. The function should print out a "map" of which points in the array are below the water level. In particular, each position at or below the water level will be represented with a"*"and each position above the water level will be represented with a An example map might look like this: k kok kkxkExplanation / Answer
The function would be
void floodMap(double arr[][4],int row,double h)
{
for(int i=0;i<row;i++)
{
for(int j=0;j<4;j++)
{
if(arr[i][j]>h)
cout<<"_";
else
cout<<"*";
}
cout<<" ";
}
}
Do give a thumbs up and in case there are doubts leave a comment.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.