c - Unable to declare a string properly -



c - Unable to declare a string properly -

i newbie working on pset2 cs50 caesar cipher. purpose of programme take string input user , increment letters key (also provided user). ex : abc key 2 encrypted 'cde' note : case preserved , special characters untouched

error message prompt is " utilize of undeclared identifier input "

i unable declare string named input properly. indicate, right syntax?

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, string argv[]) { int n = 0, key = 0; //sanity check int printf("\ninput:"); while (isdigit(atoi(argv[1])) == true || atoi(argv[1]) <= 0 || argc != 2) { string input = getstring(); } n = strlen(input); key = atoi(argv[1]); (int = 0; < n; i++) { if (isupper(input[i])) { int convnum = (input[i] - 65); int cipher = (convnum + key) % 26; //convert normal asci 1 time again , print int asciwrd = cipher + 65; printf("%c", asciwrd); } else if (islower(input[i])) { int convnum = input[i] - 97; int cipher = (convnum + key) % 26; int asciwrd = cipher + 97; printf("%c", asciwrd); } } else printf("%i",input[i]); printf("\n"); }

c string

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

java - Parsing XML, skip certain tags -

c# - ASP.NET MVC Sequence contains no matching element -