program compiles but blk box just sits there

This is a discussion on program compiles but blk box just sits there within the C++ Programming forums, part of the General Programming Boards category; I am trying to read in a file that says: My name is Kristin Baten and I know how to ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    15

    Angry program compiles but blk box just sits there

    I am trying to read in a file that says:
    My name is Kristin Baten and I know how to program.
    R

    The 'R' is used as a key to reencode the above message. R is 17 letters away from'A'. Each letter in theoriginal message should be 17 letters ahead. The code I am attaching is only to figure out how far away the key is from 'A'
    Can anyone help with this???
    Attached Files Attached Files

  2. #2
    Registered User lobo's Avatar
    Join Date
    Oct 2001
    Posts
    71
    Your code loops in while loop at line #59 forever or until killed . That loop is quite useless there...

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    15
    Thanks Lobo,

    My instructor helped me to figure that out. I have revised the program now I have another loop.... What I am trying to do is to re-encode the original message by using the encoding key as the beginning of the alphabet instead of A. So my alphabet starts with R. This will in turn change my original message. The way I am doing the swapping is tedious, but I can't think of another way. I am attaching the new code.

    The output file reads:

    My name is Kristin Baten and I know how to program.

    R

    The output I am getting is a file full of n's.
    Attached Files Attached Files

  4. #4
    Registered User lobo's Avatar
    Join Date
    Oct 2001
    Posts
    71
    Your loop should be based on counter value (while (conter < 52)), not on sentence[counter] - you want loop over all characters of old sentence, no? You should init counter to 0 and increment it in each iteration of loop until you process whole sentence...

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    15
    I am not getting letters in my output. Do I have the static cast statements in correctly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program compiles, runs, but produces no output
    By happyclown in forum C Programming
    Replies: 11
    Last Post: 01-28-2009, 04:43 AM
  2. Program compiles; won't build
    By Kayoss in forum C++ Programming
    Replies: 1
    Last Post: 05-12-2006, 09:46 AM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  4. Dialog Box & Property Sheet :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-01-2002, 01:33 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21