C++用指针构造回文#include#includevoid main(){ char a[20]={0},*p1,*p2; int i; couta; i=strlen(a); p1=&a[i-1]; p2=&a[i]; while(p1) { *p2++=*p1--; } cout
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 06:34:15
C++用指针构造回文#include#includevoid main(){ char a[20]={0},*p1,*p2; int i; couta; i=strlen(a); p1=&a[i-1]; p2=&a[i]; while(p1) { *p2++=*p1--; } cout
C++用指针构造回文
#include
#include
void main()
{
char a[20]={0},*p1,*p2;
int i;
couta;
i=strlen(a);
p1=&a[i-1];
p2=&a[i];
while(p1)
{
*p2++=*p1--;
}
cout
C++用指针构造回文#include#includevoid main(){ char a[20]={0},*p1,*p2; int i; couta; i=strlen(a); p1=&a[i-1]; p2=&a[i]; while(p1) { *p2++=*p1--; } cout
while (p1 - a >= 0)
{
...
}
*p2 = '\0';
cout