Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I get my code to show virticle rather then horozontal? #include #include using namespace std; / / Implement the function / / with

How do I get my code to show virticle rather then horozontal?
#include
#include
using namespace std;
//Implement the function
//with parameter as a character
string getCode(char eachChar)
{
//Define the string input text
string text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string morse[]={".-","-...","-.-.","-..",".","..-.","--.",
"....","..",".---","-.-",".-..","--",
"-.","---",".--.","--.-",".-.","...","-",
"..-","...-",".--","-..-","-.--","--.."};
//Get the index for the character
int index = text.find(eachChar);
//If the index is not equal to -1
//then return index
if (index !=-1)
return morse[index];
//Otherwise return space
else
return "";
}
//main method
int main()
{
//Declare the string variable
string input,morseCode="";
//Prompt and read the word from the user
cout << "Enter a word and will translate it to Morse code:";
getline(cin, input);
//Using for-loop to get the morse code from the method
for (int i =0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions