Question: C++ recursive. Modify the following code to add the recursive function to repeatedly find the mapped numbers to satisfy the equation. code: #include proj3.hpp #include
C++ recursive.
Modify the following code to add the recursive function to repeatedly find the mapped numbers to satisfy the equation.
code:
#include "proj3.hpp"
#include
#include
using namespace std;
bool puzzleSolver(std::string s1, std::string s2, std::string s3, std::map<char, unsigned> & mapping)
{
std::string Q1="",Q2="",Q3="";
for(std::string::size_type i=0;i Q1=Q1+std::to_string(mapping.at(toupper(s1[i]))); } for(std::string::size_type i=0;i Q2=Q2+std::to_string(mapping.at(toupper(s2[i]))); } for(std::string::size_type i=0;i Q3=Q3+std::to_string(mapping.at(toupper(s3[i]))); } int T1=std::stoi(Q1); int T2=std::stoi(Q2); int T3=std::stoi(Q3); if(T1+T2==T3) return true; else return false; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
