Question
C++ Programming The MorseConvert program will need to load the file codes.dat with the mappings of the letters and numbers to the Morse
C++ Programming
The MorseConvert program will need to load the file "codes.dat" with the mappings of the letters and numbers to the Morse Code.
Develop a function that has the following signature:
bool LoadMorseCodes(Code arrCodes[], const int iTotalCount)
The function will open the file codes.dat, reads its contents and store the data in the array of "Code" structures passed to it. Finally the function should close the file before it exits.
Note: Even though there are exactly 36 codes, develop the function so that it "loops"
const int iTotalCount
times and not a hard-coded 36.
Your function must use std::string functions to parse the data. I recommend functions like find() and substr().
codes.dat file contents:
A,.-
B,-...
C,-.-.
D,-..
E,.
F,..-.
G,--.
H,....
I,..
J,.---
K,-.-
L,._..
M,--
N,-.
O,---
P,.--.
Q,--.-
R,.-.
S,...
T,-
U,..-
V,...-
W,.--
X,-..-
Y,-.--
Z,--..
1,.----
2,..---
3,...--
4,....-
5,.....
6,-....
7,--...
8,---..
9,----.
0,-----
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started