0
#include<stdio.h>
#include<cs50.h>
#include<string.h>

int main(int argc,string argv[])
{
    if (argc!=2)
    {
        return 1;
    }
    else 
    {   int i=0;
        for (i=0;i<=strlen(argv[1]);i++)
           {
               if (!isalpha(argv[1][i]))
               {
               return 1;
               }
           }
    }


    string ptext;
    printf("plaintext:");
    gets(ptext);
    printf("cyphertext:");

I get the error expected prompt for input, found none for all test cases and I don't understand where the problem is? alternatives of get_string also don't work.

1

Use <, not <=, in your loop. For i being strlen(argv[1]), argv[1][i] is '\0', which is not alphabetic, so you leave the function (and end the programme).

1
  • Thanks! I forgot to remove that after a previous problem.
    – SajanGohil
    Aug 14 '17 at 13:33

You must log in to answer this question.

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