Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
StrStrPbrk
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////////StrStrPbrk // //prototypes: //char* strstr(char* scan,char * match); //char* strpbrk (char *scan,char* match); //this code is created by Rezaul Hoque on July 12,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ///////////////////////////////////////////////////////////////////////////// #include <iostream> #include <string.h> class NamTel{ char name[25]="hoolablah"; char tel[45]="old city code ---##!\n"; public: NamTel(){} char* getN(){return name;} char* getT(){return tel;} void disp(){ std::cout<<getN()<<"\n"<<getT();} }; int main() { char * p; char *p2; NamTel a; a.disp(); p=strstr(a.getT(),"old city code"); if(p!=NULL) strncpy(p,"new city code",13); a.disp(); char num[7]="---##!"; p2=strpbrk(a.getT(),num); std::cout<<"The telephone number is : "; while (p2!=NULL) { std::cout<<*p2; p2=strpbrk(p2+1,num); } return 0; }
run
|
edit
|
history
|
help
0
SetHotel
Zadanie Kolokwium 2013: Trójkąty i trójkąty
FunTemp
¡Arriba, Papalotes, Arriba! v2
Float
ExceptionWhat
Updated Linked Lists - 5/10/2017 V3.0
Rectangle overlap
ExceptionHandling4
Dar