Program to trim a given character from a string.

Answer Posted / dj

#include<iostream>
using namespace std;
#include<string.h>
int main()
{
char string[]="lhellolollla";
int i=0;
int count=0;
while(i<strlen(string))
{
while(string[i+count]=='l')
count++;
string[i]=string[i+count];
i++;

}
printf("%s",string);
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does static variable mean in c?

649


How can I find out if there are characters available for reading?

643


How do I convert a string to all upper or lower case?

627


How does #define work?

646


How can my program discover the complete pathname to the executable from which it was invoked?

660






Where static variables are stored in c?

584


What is your stream meaning?

605


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

804


Are there any problems with performing mathematical operations on different variable types?

575


What is quick sort in c?

581


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1594


Write a code to generate a series where the next element is the sum of last k terms.

732


How many keywords (reserve words) are in c?

618


Do you know the purpose of 'register' keyword?

642


What does void main return?

602