0

I've read very similar questions, but nothing about check50 stopping only the "world, say hello" line. Previous questions were solved by adding the "\n", but I already have that...

jharvard@appliance (~/Dropbox/pset2): check50 2014.fall.pset2.caesar caesar.c
:) caesar.c exists
:) caesar.c compiles
:) encrypts "a" as "b" using 1 as key
:) encrypts "barfoo" as "yxocll" using 23 as key
:) encrypts "BARFOO" as "EDUIRR" using 3 as key
:) encrypts "BaRFoo" as "FeVJss" using 4 as key
:) encrypts "barfoo" as "onesbb" using 65 as key
:( encrypts "world, say hello!" as "iadxp, emk tqxxa!" using 12 as key
   \ expected output, but not "iadxp emk tqxxa\n"
:) handles lack of argv[1]

I have my printf("\n"); at the end of my program, inside my int main brackets. It runs ("\n") on everything else except this line. I can't figure out why or what I'm doing incorrectly with my code. I appreciate your help.

1

:( encrypts "world, say hello!" as "iadxp, emk tqxxa!" using 12 as key

\ expected output, but not "iadxp emk tqxxa\n"

It looks like the difference is that it's expecting an exclamation point at the end of the line, and your program didn't write one there.

3
  • I tried running the line "world, say hello!" with a shift of 12 and my program did it correctly. See below. When I check50, it's not cooperating. Any ideas? jharvard@appliance (~/Dropbox/pset2): ./caesar 12 world, say hello! iadxp, emk tqxxa!
    – Jzag
    May 24 '15 at 16:38
  • 1
    I figured it out. I was using if (p[i] == 32) printf(" "); for spaces and used an else statement for characters that were not 'A' - 'Z' or 'a' - 'z'. Instead, I used the if (isalpha(p[i])) to replace my first "if" statement and it worked. My previous program worked too, but I'm guessing it's not what they wanted.
    – Jzag
    May 24 '15 at 20:45
  • that's what I did too
    – BooFluff
    May 25 '15 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .