Create C++ program.Convert this string to Tap Code using structures.
It is very important to use structures in this program.
The tap code is based on a Polybius square using a 5×5 grid of letters representing all the letters of the Latin alphabet, except for K, which is represented by C.
The listener only needs to discriminate the timing of the taps to isolate letters.
Each letter is communicated by tapping two numbers
For example, to specify the letter "B", one taps once, pauses, and then taps twice.
Or to communicate the word "water", the cipher would be the following (the pause between each number in a pair is smaller than the pause between letters):
| W | A | T | E | R |
|---|---|---|---|---|
|
5, 2 |
1, 1 |
4, 4 |
1, 5 |
4, 2 |
|
····· ·· |
· · |
···· ···· |
· ····· |
···· ·· |
The letter "X" is used to break up sentences, and "K" for acknowledgements.
Because of the difficulty and length of time required for specifying a single letter, prisoners often devise abbreviations and acronyms for common items or phrases, such as "GN" for Good night, or "GBU" for God bless you.[1]
By comparison, Morse code is harder to send by tapping or banging because it requires the ability either to create taps with a clear and precise rhythm or to produce two different-sounding noises. Morse code also takes longer to learn. Learning the Polybius square simply requires one to know the alphabet and the short sequence "AFLQV" (the initial letter of each row).
| Roman alphabet tap code | |||||
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | A | B | C/K | D | E |
| 2 | F | G | H | I | J |
| 3 | L | M | N | O | P |
| 4 | Q | R | S | T | U |
| 5 | V | W | X | Y | Z |
| The tap code table | |||||
I have used hash table for this problem. When a string is given we try to obtain the pair of integers from the Roman alphabet tap code.
#include <iostream>
#include <string.h>
using namespace std;
// A structure for storing hash values based on the alphabets. It's corresponding row and column.
struct col{
char c;
int i;
int j;
};
void ans(char*);
int main() {
// your code goes here
char* input;
cout<<"Enter the string: ";
cin>>input;
ans(input);
return 0;
}
void ans(char* input)
{
col a[25];
a[0].c = 'A';
a[0].i = 1;
a[0].j = 1;
a[1].c = 'B';
a[1].i = 1;
a[1].j = 2;
a[2].c = 'C';
a[2].i = 1;
a[2].j = 3;
a[3].c = 'D';
a[3].i = 1;
a[3].j = 4;
a[4].c = 'E';
a[4].i = 1;
a[4].j = 5;
a[5].c = 'F';
a[5].i = 2;
a[5].j = 1;
a[6].c = 'G';
a[6].i = 2;
a[6].j = 2;
a[7].c = 'H';
a[7].i = 2;
a[7].j = 3;
a[8].c = 'I';
a[8].i = 2;
a[8].j = 4;
a[9].c = 'J';
a[9].i = 2;
a[9].j = 5;
a[10].c = 'L';
a[10].i = 3;
a[10].j = 1;
a[11].c = 'M';
a[11].i = 3;
a[11].j = 2;
a[12].c = 'N';
a[12].i = 3;
a[12].j = 3;
a[13].c = 'O';
a[13].i = 3;
a[13].j = 4;
a[14].c = 'P';
a[14].i = 3;
a[14].j = 5;
a[15].c = 'Q';
a[15].i = 4;
a[15].j = 1;
a[16].c = 'R';
a[16].i = 4;
a[16].j = 2;
a[17].c = 'S';
a[17].i = 4;
a[17].j = 3;
a[18].c = 'T';
a[18].i = 4;
a[18].j = 4;
a[19].c = 'U';
a[19].i = 4;
a[19].j = 5;
a[20].c = 'V';
a[20].i = 5;
a[20].j = 1;
a[21].c = 'W';
a[21].i = 5;
a[21].j = 2;
a[22].c = 'X';
a[22].i = 5;
a[22].j = 3;
a[23].c = 'Y';
a[23].i = 5;
a[23].j = 4;
a[24].c = 'Z';
a[24].i = 5;
a[24].j = 5;
int z,y,k=0,x;
while(strlen(input)) // until the length of the string
do the following
{
if(input[k]>='L')
x =
input[k]-65-2; // for the last three rows we have x to be ascii
value -65-2
else
x = input[k]-65-1; // else x will be ascii value -65-1
z = a[x].i;
y = a[x].j;
cout<<a[x].c<<" =
"<<z<<","<<y;
k++;
}
}
Create C++ program.Convert this string to Tap Code using structures. It is very important to use...
Create C++ program.Convert this string to Tap Code using structures. It is very important to use structures in this program. The tap code is based on a Polybius square using a 5×5 grid of letters representing all the letters of the Latin alphabet, except for K, which is represented by C. The listener only needs to discriminate the timing of the taps to isolate letters. Each letter is communicated by tapping two numbers the first designating the row (Down) the...
Program Description: A Java program is to be created to produce Morse code. The Morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). In sound-oriented systems, the dot represents a short sound and the dash represents a long sound. Separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. In a sound-oriented...
using basic c++ and use no functions from c string library
b) Write a fragment of code (with declarations) that reads a pair of words from the keyboard and determines how many letters in corresponding positions of each word are the same. The words consist only of the letters of the English alphabet (uppercase and lowercase). For example, if the words are coat and CATTLE, the following output should be generated: 012245 0122 matching letter in position 0 t is...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...
"For two thousand years, codemakers have fought to preserve secrets while codebreakers have tried their best to reveal them." - taken from Code Book, The Evolution of Secrecy from Mary, Queen of Scots to Quantum Cryptography by Simon Singh.The idea for this machine problem came from this book.You will encrypt and decrypt some messages using a simplified version of a code in the book. The convention in cryptography is to write the plain text in lower case letters and the encrypted text in upper case...
okay so here is my c++ code and the errors im really stuck on
fixing what i did wrong it seems to be the same repeated
error
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses A your program should use a loop and your morse code printing...
In C++ Do not use a compiler like CodeBlocks or online. Trace the code by hand. Do not write "#include" and do not write whole "main()" function. Write only the minimal necessary code to accomplish the required task. Save your answer file with the name: "FinalA.txt" 1) (2 pts) Given this loop int cnt = 1; do { cnt += 3; } while (cnt < 25); cout << cnt; It runs ________ times ...
Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...
please use dia to draw the e-r diagram to create Entity -
Relationship Diagrams
then use MS access
This project requires you to create a database design. Your design will be documented in a set of Entity-Relationship Crow's Foot diagrams using the representation as shown in the lecture materials. Draw a set of Entity-Relationship diagrams to model the following scenario. The Maggs Realty Company wants to track the Sales Offices that they have across all of Ontario They are interested...
General Requirements: • You should create your programs with good programming style and form using proper blank spaces, indentation and braces to make your code easy to read and understand; • You should create identifiers with sensible names; • You should make comments to describe your code segments where they are necessary for readers to understand what your code intends to achieve. • Logical structures and statements are properly used for specific purposes. Objectives This assignment requires you to write...