why is my code not letting me repeat? after the first run, and you type y to repeat it skips the run and say repeat again?
[
void line(){
char ans;
do{
string line;
int count=0;
cout<<"Enter a line of text.\n";
getline(cin,line);
for(int x=0;x<line.length();x++){
if(islower(line[x])&&isalpha(line[x+1])&&isalpha(line[x+2])
&&isalpha(line[x+3])&&(!(isalpha(line[x-1])))&&(line[x+4]==' '||
line[x+4]=='.'||line[x+4]==','||line[x+4]=='\0')){
count+=5;
}
else{
count=0;
}
if(count==5){
line[x]='l';
line[x+1]='o';
line[x+2]='v';
line[x+3]='e';
}
if(isupper(line[x])&&isalpha(line[x+1])&&isalpha(line[x+2])
&&isalpha(line[x+3])&&(!(isalpha(line[x-1])))&&(line[x+4]==' '||
line[x+4]=='.'||line[x+4]==','||line[x+4]=='\0')){
count+=4;
}
else{
count=0;
}
if(count==4){
line[x]='L';
line[x+1]='o';
line[x+2]='v';
line[x+3]='e';
}
}
for(int y=0;y<line.length();y++){
cout<<line[y];
}
cout<<endl;
cout<<"Repeat?(y/n)";
cin>>ans;
}while(ans=='y');
}
]