Created
April 11, 2016 16:22
-
-
Save i0na-k/48daba9bb9808ab8d96f05eb04f8fc09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
int main(int argc, string argv[]) | |
{ | |
if (argc != 2) | |
return 1; | |
int k = atoi(argv[1]); | |
//we want to add the number of k to our plaintext - to do this we need to change from string to int (atoi) | |
string t = GetString(); //getting plaintext off user; we then need to convert each char in array to ascii value | |
int i; | |
for (i=0; i<strlen(t);i++) | |
{ | |
if (isupper(t[i])); | |
{ | |
printf ("%c",t[i]+k); | |
} | |
if (islower(t[i])); | |
{ | |
printf("%c", t[i]+k); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment