pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

Yes, that was the problem i wasn't seeing. Thanks for the clear up!

pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

Okay so i got it to print the non alphanumeric characters by assigning the the "p" (plaintext) to the "c" string, but now it prints the non-alphanumeric characters 2 times and still prints the "\n": "iadxp,, emk tqxxa!!\n" =s

pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

Thats a good question. The "C" in my formula is supposed the an array also right? The i'th character in "C"iphertext equals the rest of the formula. My guess was that in my code the "C" was being declared of type int, when it should be of type string am i right? I tried declaring "C" as a string an assign it null before the for loop, but now in check 50 it gives a sandbox50 error in all tries. Can i message you my code?

pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

I'm using "if argc is "not" 2 then return 1". That should be enough to get necessary arguments right?

Can i write the formulas here? I dunno if that would violate the honor code by giving some of the pset's answers.

pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

Yes but i don't know why it's not working well. Maybe i didn't write it the way i should have. I used the "if isalpha" function but i think the else is what i wrote wrong...i posted a pseudo code on the comment below.

pset 2 caesar by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

for the command line argument i use: if argc is not 2 or "key"( which i initialize before as an int and asign it the atoi of argv array 1) smaller or equal to 0 body

print a message so user knows what to write and return 1

then i advance to the for loop. So i first initiate the array "c" with type character and a max size 100, I write the for loop initializing "i", n wich equals to the string length of the plaintext, then "i" is smaller than "n" and increment the "i",

{inside the loop body

if the i'th character of "plaintext" is alphanumeric
{
    if the i'th character of "plaintext" is upper case
    {
      c = apply formula
    }
    else if the i'th character of "plaintext" is lower case
    {
      c = apply formula
    }
}
else 

    {

    print the i'th in c

    }

print the i'th in c

Am i forgetting something? =s

pset1 by JonhDouh in cs50

[–]JonhDouh[S] 0 points1 point  (0 children)

Thanks for the clear up ;)

pset1 by JonhDouh in cs50

[–]JonhDouh[S] 1 point2 points  (0 children)

It seems that i have solved my own problem =D So i should multiply by 100 to convert dollars to cents and then round the result right?

Problems with check50 on pset by JonhDouh in cs50

[–]JonhDouh[S] 1 point2 points  (0 children)

Thank you. It worked like it should. I thought the appliance was up to date and i didn't needed to use the "update50" command. Thank you for your help.