انجمن برنامه نویسان
.:: Your Adversing Here ::.

نحوه عملکرد توابع strchr و strrchr

  • چهار شنبه 5 بهمن 1390برچسب:,
  • <-PostCategory->

include
#include
using namespace std;
void main(void)
{
char ch='r';
char string[] =
"The quick brown dog jumps over the lazy fox";
char fmt1[] =
" 1 2 3 4 5";
char fmt2[] =
"12345678901234567890123456789012345678901234567890";
char* pdest;
int result;
cout<<"String to be searched: \n\t\t"< cout<<"\t\t"< cout<<"Search char:\t"< /* Search forward. */
pdest=strchr(string, ch);
result=pdest - string + 1;
if( pdest != NULL )
cout<<"Result:\tfirst "< <<" found at position "< else
cout<<"Result:\t"< /* Search backward. */
pdest=strrchr(string, ch);
result=pdest - string + 1;
if( pdest != NULL )
cout<<"Result:\tfirst "< <<" found at position "< else
cout<<"Result:\t"< }

//end
 


نظرات شما عزیزان:

نام :
آدرس ایمیل:
وب سایت/بلاگ :
متن پیام:
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

 

 

 

عکس شما

آپلود عکس دلخواه:





مشاهده ادامه مطلب نحوه عملکرد توابع strchr و strrchr