I don't know if this is what you meant, but now the 0 terminates the program and the encoding the number has been fixed, but the actual interpreting of the sentence has totally screwed up. I'm assuming it has something to do with a being a character instead of an integer like it was before.. or something like that.. any idea? lol
Code:
int main(void){
int i,a;
char sent[100];
while(fgets(sent,sizeof(sent),stdin)){
a = sent[0];
if(a == '0'){
break;
}
else{
fgets(sent,sizeof(sent),stdin);
for(i=0;sent[i];i++){
if(sent[i] == ' ')
sent[i] = ' ';
else if((sent[i] + a) > 'Z')
sent[i] = 'A' + ((sent[i] + a) - 'Z')-1;
else
sent[i] += a;
}
printf("%s\n",sent);
}
}
return 0;
}