|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
C + + program to answer questions Thank you!
Delete one of a string of characters used to prepare a delete function DEL-STR designated location of the characters defined variables N, importation would delete to delete the location of the string will be deleted after the output (using function to achieve) |
Char * DEL_STR (int n;int strlong;char 6-12)
{
Char *q;
Q=p;
If (n<0||n>stringlong);
{
Cout<< "ERROR!!";
}
Else
{
If (n==0)
{
Q--;
}
Else
{
P=p+n;
For (i=stringlong-n+1;i<stringlong;i++)
{
*p=* (P +1);
}
}
P=q;
Return sources
}
}
=========================
LZ try, which is stringlong length of the string. |
P no movement itself, and certainly not |
The remaining operations are not teachers ah : lol : |
Achieve a version of the c
#include "String.h>
Void del_str (int n, char *str)
{
Char *pos;
Int i, str_length;
Str_length = strlen (str);
If (n = str_length "0 | | n")
{
Printf ( "Error! Delete positon is error!\n");
Return;
}
Poses = str;
For (i = n; i "str_length; i++)
{
Pos[i] + = pos[i 1];
}
Return;
} |
| |