Excuse me,
When I practice the pset2 program, I follow the step at 'Validating the Key'.
But I have the problem like below code, I want to compiler and output look like as
$ ./caesar 20
Success
20
or
$ ./caesar 20x
Usage: ./caesar key
but this was unexpected.
help me~pls.
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
int k;
int num;
for(int i=1; i<argc; i++)
{
for(int j=0,n=strlen(argv[i]); j<n; j++)
{
k = atoi(&argv[i][j]);
//printf("K:%i\n",k);
//printf("&argv[%i][%i]:%s \n",i,j,&argv[i][j]);
if(atoi(&argv[i][j])!=0)
{
printf("Success\n");
}
else
printf("Usage: ./caesar key\n");
// printf("argv[%i][%i]:%c\n",i,j,argv[i][j]);
}
}
return 0;
}