Question: zybooks 2 0 . 1 2 Project 4 : Map Coloring 2 0 . 1 2 Project 4 : Map Coloring Testing is complete. Please
zybooks Project : Map Coloring
Project : Map Coloring
Testing is complete. Please alert me if you encounter problems.
Construct a coloring of a map such that no two neighboring countries have the same color. For this project you will read in a map
encoded as a text file. An example Follows:
AABBBBBCCDDEFGGG HHIHHJJJKK
ABBBBBCCDDEFGGGGHHHIHHJJJKK
AAAAAALLLLLEMMMMMHHHHHHHHHHH
AAAAALLLLEMMMM HHHHHHHHHH
Are not part of any country and do not have to be colored.
Countries will be marked A though Z
While a coloring of the map might look like:
You are asked to produce a string in the following format:
Color : B F H
Color : J L M
Color : A D G K
Color : C E
The grading engine will parse this string to verify your coloring. Valid colorings are not unique.
You must implement the following function:
std::string colormapstd:string filename
The input is the name of a file eg "map.txt and you return the coloring described above.
The rest of your design is up to you.
main.cpp code
#include
#include
#include
#include "colormap.h
using namespace std;
int main
you may modify for testing.
std::string mapname;
std::cin mapname;
std::string mapkey colormapmapnametxt;
std::cout mapkey;
return ;
Given colormap.h code
#ifndef colormaph
#define colormaph
#include
#include
#include
std::string colormapstd::string;
#endif
Given colormap.cppcode
#include
#include
#include "colormap.h
std::string colormapstd::string
return "TODO";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
