GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 24-Sep-2006, 13:59
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Morse Code Program Using Switch Statement


How To Do It
  #2  
Old 24-Sep-2006, 14:29
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,688
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Morse Code Program Using Switch Statement


Quote:
Originally Posted by glacier
How To Do It

CPP / C++ / C Code:
    switch(has_a_program_specification) {
        case 0: write_the_program_specification(); /* note: fall-through is deliberate */

        case 1: show_the_program_specification();
                break;

        default: cout << "Illegal value: has_a_program_specification = "
                      << has_a_program_specification << endl;
    }

Regards,

Dave
  #3  
Old 24-Sep-2006, 14:49
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Re: Morse Code Program Using Switch Statement


thanks hope it works for me
  #4  
Old 24-Sep-2006, 15:07
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Re: Morse Code Program Using Switch Statement


i didn't understandit
  #5  
Old 24-Sep-2006, 15:28
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Re: Morse Code Program Using Switch Statement


how to declare it in form of char
  #6  
Old 24-Sep-2006, 15:35
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 889
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough

Re: Morse Code Program Using Switch Statement


Senior members might not reply to this thread if you:
  • used "Please help", "C problem" or something equally vague as the title for your thread.
  • included example code in your message and not use the syntax highlighting [c] tags.
  • did not describe the problem accurately or include the error message (if any).
  • tried to get your homework assignment solved by someone else (and did not show your attempts at solving the problem)
The guidelines for posting can be found here.
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #7  
Old 24-Sep-2006, 16:09
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,688
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Morse Code Program Using Switch Statement


Quote:
Originally Posted by glacier
i didn't understandit

In English:
If you have a program specification show us what it is.
If you don't have a program specification then write it down and show it to us.

A program specification describes what the inputs to the program are, what the outputs are, and what it is that the program has to do in order to perform the task.

For example, if the input is a string of chars a-z, 0-9 and a few punctuation (comma, period, question mark, slash, for example) and the output is supposed to be a string of '.' and '-' chars representing the International Morse characters, separated by spaces, then say it.

Once you have decided what the heck the program is supposed to do, then you consider how the data items are going to be represented internally so that you can process all Morse characters that you have to translate. (a-z, 0-9, and the punction marks that I showed require no more than six dots and dashes in various combinations for each character, so there is probably a way to hold each character in a byte if that's what you need to do. Your scheme must take into account that, unlike ASCII, different Morse characters have different lengths.

Or, each morse character can be represented as a string of length no greater than six. Or whatever... It's your program and your design. You decide.

Then, decide how the program is going to flow: is it going to ask the user for a string and then print out the dots and dashes? Is is going to print out a "canned" message? Is it going to print out all of the characters that it can? Or what?

Regards,

Dave
  #8  
Old 24-Sep-2006, 18:34
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Re: Morse Code Program Using Switch Statement


hi plz solve my problem this is my question I have to enter a to z and 0 to 9 by using switch statement and then display the morse code equivalent of the character entered and
output
INPUT_CHAR [MORSE_CODE]

PLEASE EXPLAIN ME IN SIMPLE WAY
  #9  
Old 24-Sep-2006, 19:44
glacier glacier is offline
New Member
 
Join Date: Sep 2006
Posts: 13
glacier is on a distinguished road

Re: Morse Code Program Using Switch Statement


hi plz solve my problem this is my question I have to enter a to z and 0 to 9 by using switch statement and then display the morse code equivalent of the character entered and
output
INPUT_CHAR [MORSE_CODE]

PLEASE EXPLAIN ME IN SIMPLE WAY
this is my code

CPP / C++ / C Code:
#include <iostream>

using std::cout;
using std::endl;
using std::cin;
using namespace std;

void Morsecode::inputMorse


{
for (i=0;i>0;i++);
char i ;


    cout << "Enter a character to convert:_ " << endl;
    cin >> i; 

switch(a)
{
case A: a:
cout<<"[.-]";
break;


case B : b
cout<<"[-...]";
break;

case: C : c
cout<<"[-.-.]";
break;

default:
cout << "Enter a character to convert:_ " << endl;
cout<<"[N/A]";

}

return 0;

}
Last edited by LuciWiz : 25-Sep-2006 at 06:54. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #10  
Old 24-Sep-2006, 21:19
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,242
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Morse Code Program Using Switch Statement


Quote:
Originally Posted by glacier
How To Do It
Looks like you completely ignored the previous request to read the Guidelines in your other thread.

Looks like you also ignored the same request in this thread.

Start there, and look up the switch statement in your test book.
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogMore photos on Flickr by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pipeline freeze simulation darklightred C++ Forum 6 27-Jul-2006 19:37
Noob Programmer having trouble with if and switch statements in program Heresy C Programming Language 4 17-Feb-2006 17:55
User defined headers davis Miscellaneous Programming Forum 6 16-Feb-2006 18:40
Compiling/Linking roostercogburn C Programming Language 5 08-Nov-2005 14:32
Problems with switch statement dontcare C++ Forum 4 29-Nov-2004 18:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:52.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.