你發了幾個問題啊如下:#include <iostream.h>#include <stdlib.h>void DelStr( char *src, char dst);int main( ){ char str[]="abcdefg123456?abcdefg123456?abcdefg123456?"; char dst; cout<<str<<endl; cout<<"請輸入要刪除的字元:"<<endl; cin>>dst; DelStr(str,dst); cout<<str<<endl; return 0;}//刪除字串src中的dst字元void DelStr( char *src, char dst){ char* p=src; char q=dst; while( *src!=EOF) { if ( *src == q ) { src++; continue; } *p++ = *src++; } *p="\0";}
你發了幾個問題啊如下:#include <iostream.h>#include <stdlib.h>void DelStr( char *src, char dst);int main( ){ char str[]="abcdefg123456?abcdefg123456?abcdefg123456?"; char dst; cout<<str<<endl; cout<<"請輸入要刪除的字元:"<<endl; cin>>dst; DelStr(str,dst); cout<<str<<endl; return 0;}//刪除字串src中的dst字元void DelStr( char *src, char dst){ char* p=src; char q=dst; while( *src!=EOF) { if ( *src == q ) { src++; continue; } *p++ = *src++; } *p="\0";}