I'm trying to create a program that first takes in a number that determines the amount of letters the second input (sentence) will go up. This is what I have so far:
Code:
#include <stdio.h>
#include <string.h>
int main(void){
int i=0,a=1;
char sent[100];
while(true){
scanf("%d",&a);
if(a == 0){
break;
}
gets(sent);
while(sent[i]){
if(sent[i] != " "){
sent[i] += a;
}
}
printf("%s",sent);
}
getchar();
return 0;
}
I get an error at the line: if(sent[i] != " "){
How come?
Also, even with that working, how come this program doesn't end up working ?
Thank you .