Help with C++

Discussion in 'Software' started by Akumos, Nov 19, 2007.

  1. Akumos

    Akumos Private E-2

    Hi

    I'm trying to write a console program to convert characters into morse code. I have to include this array:

    Char MorseData[] = “.- -...-.-.-.. . ..-.--. ...... .----.- .-..-- -. --- .--.--.-.-. ... - ..- ...-.-- -..--.----..”

    I need to write the function to convert the char in the relevent mores code part, each letter of morse code is in 4 characters (if the morse code is less than 4, spaces are used at the end) and I must make use of :

    strcpy(string1, string2) or
    strncpy(string1, string2,n)

    I just cant get my head around it, any help would be greatfully appriciated!

    Thanks for reading!

    Ak
     
  2. Wookie

    Wookie Sergeant Major

    I don't have too much detail to give or time to test at the moment but for this situation your probably going to use something like a for loop that loops until some int <= sizeof(morsedata) and maybe increment by four and pull out the substring and copy into another char array.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds