Code:
#include <stdio.h>
int main()
{
char *alpha[26] =
{
"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",
};
char *morse[26] =
{
".-",
"-...",
"-.-.",
"-..",
".",
"..-.",
"--.",
"....",
"..",
".---",
".-.-",
".-..",
"--",
"-.",
"---",
".--.",
"--.-",
".-.",
"...",
"-",
"..-",
"...-",
".--",
"-..-",
"-.--",
"--..",
};
int w;
while( w != 3)
{
w=0;
printf("Please select an option\n");
printf("1. Encode\n");
printf("2. Decode\n");
printf("3. Quit\n");
scanf("%d", w);
if(w==1)
printf("Encode\n"); //Encode function goes here
else if(w==2)
printf("Decode\n"); //Decode function goes here
else
printf("Wrong option selected\n");
}
}
This is just a test program and I haven't finished yet. But I get an error when I run the program. It gets to where you can select among the three options. When I select a number and hit enter I get