Home > Back-end >  Who can solve my problem in committed relationships
Who can solve my problem in committed relationships

Time:10-01

#include
#include
Double dele (char * p, char dd);

Char dd.
Int main () {
Char ch [100].
Int choice, isbreak;
Printf (" please enter a string of a string ");
Gets (ch);
Printf (" please enter the characters you want to delete ");
The scanf (" % c ", & amp; Dd);
Dele (ch, dd);
Printf (" % s ", ch);



While (dele (ch, dd) & gt; 0 {
Printf (" continue to delete a character? Yes please press 1 no press 2 ");
The scanf (" % d ", & amp; Choice);
The switch (choice) {
Case 1: printf (" please enter the characters you want to delete ");
The scanf (" % c ", & amp; Dd);
Dele (ch, dd);
Printf (" % s ", ch);
break;
Case 2: isbreak=1;
break;
}
If (isbreak==1)
break;
}

Printf (" % s ", ch);
return 0;
}


Double dele (char * p, char dd) {
int i;
Int count=0, other;
Int n=strlen (p);
for(i=0; I{
If (* p==dd)
* p=' ';
P++;
}

for(i=0; I{
If (* p!=' ')
Count++;

The else other++;

}
Return the count.
}




The purpose is to realize the circulation call a function to implement according to their own requirements to delete characters in a string but not achieve them is really a headache!!!!!! Who is a great god put the modified code send me appreciate!!!!!!

CodePudding user response:

# inlcude & lt; Stdio. H>

Int deletechar (char [] input, char ch)
{
Int count=0;

While (* input!=0)
{
If (* input==ch)
* input=' ';
The else
Count++;
Input++;
}

Return the count.
}

Void main ()
{
Char input [1024]={0};
Char ch=0, does=0, choice=0;

Printf (" please input a string of a string of \ r \ n ");
Gets (input);

Printf (" please enter the characters want to remove, and press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", ch);

Does=deletechar (input, ch);
Printf (" % s \ r \ n ", input);

While (does & gt; 0)
{
Printf (" continue to delete characters? Yes please press 1, no press 2, and then press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", choice).

If (choice=='2')
break;

Printf (" please enter the characters want to remove, and press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", ch);

Does=deletechar (input, ch);
Printf (" % s \ r \ n ", input);
}

Printf (" % s \ r \ n ", input);
}

CodePudding user response:

If it is a woman, please in committed relationships; If is a man, please the degeneration in committed relationships

CodePudding user response:

# inlcude & lt; Stdio. H>

Int deletechar (char [] input, char ch)
{
Int count=0;

While (* input!=0)
{
If (* input==ch)
* input=' ';
The else
Count++;
Input++;
}

Return the count.
}

Void main ()
{
Char input [1024]={0};
Char ch=0, does=0, choice=0;

Printf (" please input a string of a string of \ r \ n ");
Gets (input);

Printf (" please enter the characters want to remove, and press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", & amp; Ch);

Does=deletechar (input, ch);
Printf (" % s \ r \ n ", input);

While (does & gt; 0)
{
Printf (" continue to delete characters? Yes please press 1, no press 2, and then press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", choice).

If (choice=='2')
break;

Printf (" please enter the characters want to remove, and press the enter key \ r \ n ");
The scanf (" % c \ r \ n ", & amp; Ch);

Does=deletechar (input, ch);
Printf (" % s \ r \ n ", input);
}

Printf (" % s \ r \ n ", input);
}

CodePudding user response:

The original poster to fully succeed?

CodePudding user response:

Estimates have been in committed relationships, true cow
  • Related