Question: C++ Programming... Develop a function that has the following signature: string GetCode(char c, Code arrCodes[], const int iTotalCount) The job of this function is to
C++ Programming...
Develop a function that has the following signature:
string GetCode(char c, Code arrCodes[], const int iTotalCount)
The job of this function is to search through the array of Codes and locate the Morse Code that corresponds to the character
char c
that is passed in as a parameter. Once the character is located the function should return a string containing the Morse code.
My current code:
#include "stdafx.h" #include
using namespace std;
struct Code { char symbol; string code; };
bool LoadMorseCodes(Code arrCodes[], const int iTotalCount) { int i; ifstream inFile("codes.dat"); if (!inFile.is_open()) return false;
string line; for (i = 0; i return true; } int main() { Code arr[36]; LoadMorseCodes(arr, 36); int i; for (i = 0; i<36; i++) cout << arr[i].symbol << " " << arr[i].code << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
