您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strrev函数代码示例

51自学网 2021-06-03 08:32:05
  C++
这篇教程C++ strrev函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strrev函数的典型用法代码示例。如果您正苦于以下问题:C++ strrev函数的具体用法?C++ strrev怎么用?C++ strrev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strrev函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: itochar

void itochar(int x, char* szBuffer, int radix){	int i = 0, n, xx;	n = x;	while (n > 0)	{		xx = n%radix;		n = n/radix;		szBuffer[i++] = '0' + xx;	}	szBuffer[i] = '/0';	strrev(szBuffer);}
开发者ID:durkmurder,项目名称:vj_qt,代码行数:13,


示例2: main

int main(){    int t;    scanf("%d",&t);    while(t--){	char S[10000],A[10000],C[100000]={"0"},B[10000];    int i=0,temp1=0,temp2=0,temp3=0,size=0,size2=0,j,k=0,temp4=0,temp5=0,carry=0,t;    scanf("%s",S);    scanf("%s",B);    while(S[i]!='/0')    {        size++;        i++;		C[k]='0';		k++;    }	i=0;    while(B[i]!='/0')    {        size2++;        i++;		C[k]='0';		k++;    }	for(j=size2-1;j>=0;j--){    for(i=size-1;i>=0;i--)    {        temp1=(S[i]-48)*(B[j]-48);        temp2=(temp1+temp3)%10;        temp3=(temp1+temp3)/10;		A[size -1-i]=temp2+48;	}	A[size]=temp3+48;	temp3=0;	for(i=size;i>=0;i--)	{		temp4=(A[size-i]-48)+(C[(size2-1-j)+(size-i)]-48);		temp5=(temp4+carry)%10;		carry=(temp4+carry)/10;		C[(size2-1-j)+(size-i)]=temp5+48;	}	}	if(carry!=0)	C[size2+size]=carry+48;	i=0;	while(C[k-1-i]<=48){		C[k-1-i]='/0';i++;}	printf("%s/n",strrev(C));    }	return 0;}
开发者ID:NishantRaj,项目名称:program_files,代码行数:51,


示例3: main

int main(int argc, char *argv[]){    if (argc != 2)    {        printf("Please used as : argv[0] strings/n");        return 0;    }    printf("src str is : %s/n", argv[1]);    reverse(argv[1]);    printf("dst str is : %s/n", argv[1]);    strrev(argv[1]);    printf("drr str is : %s/n", argv[1]);    return 0;}
开发者ID:fzy112001,项目名称:fzyfirst,代码行数:14,


示例4: get_sequence

const char* get_sequence(const bam1_t *b) {    if(b == NULL) die("get_sequence: parameter error/n");    const uint8_t *seq = bam_get_seq(b);    size_t len = b->core.l_qseq;    char* sequence;    sequence = malloc(len*sizeof(char));    uint8_t offset = (b->core.flag & BAM_FREVERSE) ? 16 : 0;    size_t i;    for (i=0; i<len; i++) {        switch(bam_seqi(seq, i) + offset)        {        case 1:            sequence[i] = 'A';            break;        case 2:            sequence[i] = 'C';            break;        case 4:            sequence[i] = 'G';            break;        case 8:            sequence[i] = 'T';            break;        case 15:            sequence[i] = 'N';            break;        //Complements (original index + 16)        case 17:            sequence[i] = 'T';            break;        case 18:            sequence[i] = 'G';            break;        case 20:            sequence[i] = 'C';            break;        case 24:            sequence[i] = 'A';            break;        case 31:            sequence[i] = 'N';            break;        default:            sequence[i] = 'N';            break;        }    }    if (offset) sequence = strrev(sequence);    return sequence;}
开发者ID:r3fang,项目名称:bam2fastq,代码行数:50,


示例5: inputAndStore

int inputAndStore(int input[]){	char in[1200];	gets(in);	strrev(in);	//reverse(in);	//input convertion into int array	int i,len;	for(i=0;in[i]!='/0';i++) input[i]=in[i]-'0';	len=i;	for(;i<1200;i++) input[i]=0;	return len;//retuns the number of digits in input	}
开发者ID:devanshu-ghosh,项目名称:Competitive-Programming,代码行数:14,


示例6: main

int main() {    std::cout << strcmp("abc", "abcd") << " = " << -1 << std::endl;    std::cout << strcmp("abcde", "abc") << " = " << 1 << std::endl;    std::cout << strcmp("bcde", "abc") << " = " << 1 << std::endl;    std::cout << strcmp("abcd","abcd") << " = " << 0 << std::endl;    std::cout << strcmp("asdf", "") << " = " << 1 << std::endl;        char c[100] = "";    strcat(c, "Hello, world!");    printf("%s/n", c);    strcat(c, "xxxaaabbb");    printf("%s/n", c);    std::cout << strlen("") << " = " << 0 << std::endl;    std::cout << strlen("abc") << " = " << 3 << std::endl;    std::cout << strlen(c) << std::endl;        strrev(c, "1234512");    printf("%s/n", c);    strrev(c, "");    printf("%s/n", c);}
开发者ID:AOrazaev,项目名称:orazaev,代码行数:23,


示例7: trim

char *toString(BigInt *num) {    num = trim(num);    char *result = calloc(num->length+1, sizeof(char));    int i;    int ifnegative = 0;    if (num->sign == -1) {        ifnegative = 1;        result[num->length] = '-';    }    for (i=0; i<= num->length-1 ;i++) {        result[i] = '0' + num->digits[i];    }    return strrev(result);}
开发者ID:michbad,项目名称:misc,代码行数:14,


示例8: reverse

void reverse(char *s){	char *word;	word = strtok(s," ");	while(word != NULL)	{		//printf("%s/n",word);		strrev(word);		printf("%s ",word);		word = strtok(NULL, " ");	}	printf("/n");	return;}
开发者ID:pratyush-nigam,项目名称:spoj-stuff,代码行数:14,


示例9: main

int main(){  char cadena[10];  //printf("ingrese algo:"); // scanf("%s",cadena);  //printf("la cadena es:%s",cadena);   printf("ingrese su nombre:");   scanf("%s",cadena);   strrev(cadena);   printf("el nombre es:%s",cadena);}
开发者ID:angelorid96,项目名称:1AFundamentosprogramacion,代码行数:14,


示例10: GW_ask_tail_number_string

extern int GW_ask_tail_number_string(const char *szInput, char *sTailNum){	std::string	strTailNum;	int nLength = (int)(strlen(szInput));	for (int i=nLength-1; i>=0; i--)	{		if (szInput[i] >= 0x30 && szInput[i] <= 0x39)			strTailNum += szInput[i];		else			break;	}	strcpy(sTailNum, strrev((char*)(strTailNum.c_str())));	return (int)(strlen(sTailNum));}
开发者ID:huzhongying3,项目名称:GWDimList,代码行数:14,


示例11: _cikarma

void _cikarma(char *sayi1, char *sayi2, char *sonuc){	char *s1, *s2;	int elde = 0, kontrol, i, sayi_uzunlugu;	sayi_uzunlugu = sayi_esitle(sayi1, sayi2);	kontrol = strlen(sayi2);	if ((sayi_kontrol(sayi1, sayi2) > 0)) {		s1 = sayi1; s2 = sayi2;	}	else {		s1 = sayi2; s2 = sayi1;	}	strrev(s1);	strrev(s2);	memset(sonuc, 0, kontrol+1);	for (i = 0; i < kontrol; i++) {		if (s1[i] < s2[i]) {			if (s1[i+1] == 0) {				s1[i+1] = 9;			}			else				s1[i+1]--;			elde = s1[i] + 10;			sonuc[i] = (elde - s2[i]) + '0';		}		else			sonuc[i] = (s1[i] - s2[i]) + '0';	}	strrev(sonuc);	strrev(s1);	strrev(s2);	sayi_temizle(sonuc, sayi_uzunlugu);	sayi_temizle(s1, sayi_uzunlugu);	sayi_temizle(s2, sayi_uzunlugu);}
开发者ID:hasanozgan,项目名称:dos-cezatakip,代码行数:37,


示例12: itoa

char* itoa(int value, char*  str, int radix){  int  rem = 0;  int  pos = 0;  char ch  = '!' ;  do  {    rem    = value % radix ;    value /= radix;    if ( 16 == radix )    {      if( rem >= 10 && rem <= 15 )      {        switch( rem )        {          case 10:            ch = 'a' ;            break;          case 11:            ch ='b' ;            break;          case 12:            ch = 'c' ;            break;          case 13:            ch ='d' ;            break;          case 14:            ch = 'e' ;            break;          case 15:            ch ='f' ;            break;        }      }    }    if( '!' == ch )    {      str[pos++] = (char) ( rem + 0x30 );    }    else    {      str[pos++] = ch ;    }  }  while( value != 0 );  str[pos] = '/0' ;  return strrev(str);}
开发者ID:FlySimvol,项目名称:FlyLegacy,代码行数:49,


示例13: task_nine

//!=====================================================================void task_nine(void){    printf("^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^/n");    printf("This is nyan binary sum/n");    printf("Type your two strokes/n");    char number_one [INF_STR] = {};    char number_two [INF_STR] = {};    //char result [INF_STR] = {};    scanf(" ");    gets(number_one);    scanf(" ");    gets(number_two);    printf("N1 = <%s>, N2 = <%s>/n", number_one, number_two);    strrev(number_one);    strrev(number_two);    printf("REV N1 = <%s>, N2 = <%s>/n", number_one, number_two);    get_binsum(number_one, number_two);}
开发者ID:TheAviat0r,项目名称:my-brain-work-out,代码行数:25,


示例14: main

int main(void) {	int t;	char num[1000];	scanf("%d", &t);	fact(t, num);	strrev(num);	printf("%s", num);	int sum = 0;	t = strlen(num);	while(t--) {		sum += num[t] - '0';	}	printf("/n%d/n", sum);	return 0;}
开发者ID:csetariq,项目名称:miscellaneous,代码行数:15,


示例15: main

int main(){    char* str1 = malloc(sizeof(char) * 10);     strcpy(str1, "efgh");    char* str2 = malloc(sizeof(char) * 10);     strcpy(str2, "abcd");       strcat_m(str2, str1);     printf("%s/n", str2); // expect abcdefgh     char* rev_str1 = strrev(str1);     printf("%s/n", rev_str1); // expect hgfe        free(str1); free(str2); free(rev_str1);      return 0;}
开发者ID:pbamotra,项目名称:15513,代码行数:15,


示例16: main

int main(){  strcpy(s2, "efg");  p = strdog("abc", s2);  printf("output for strdog function p= %s/n", p);  strcpy(s, "ravikrishna");  p = strrev(s);  printf("output for strrev function p= %s/n", p);  strcpy(s1, "AABZBAADZDAA");  p = strrm(s1, "ZA");  printf("output for strrm function p= %s/n", p);  strcpy(s1, "AABZBAADZDAA");  p = strcrm(s1, "ZA");  printf("output for strcrm function p= %s/n", p);}
开发者ID:adeapuravikrishna,项目名称:C-Unix-Programming,代码行数:15,


示例17: main

int main(int argc, char **argv){  do {    printf("%s ",  argv[argc-1]);     strrev(argv[argc-1]);    printf("%s/n", argv[argc-1]);  } while(--argc);  /*  char* x = "Hello";  strrev(x);  printf("%s/n", x);  */  return 0;}
开发者ID:skrieder,项目名称:CTCI,代码行数:15,


示例18: itoa

/* signed itoa, used for %d only (see fprintf) */void itoa(int n, char *s){	register char sg;	register int i;	sg = SG(n), n = ABS(n);		/* sign & abs */	i = 0;	do		s[i++] = n % 10 + '0';	while (n /= 10);	if (sg)		s[i++] = '-';	s[i] = '/0';	strrev(s);}
开发者ID:sng7ca,项目名称:ygg,代码行数:16,


示例19: VbufInit

char *FormatName( NAME name, VBUF *pvbuf )/****************************************/{    VBUF    prefix;    bool    ctordtor;    VbufInit( pvbuf );    VbufInit( &prefix );    ctordtor = fmtSymName( NULL, name, &prefix, pvbuf, FF_NULL );    if( !ctordtor ) {        VbufConcVbuf( pvbuf, &prefix );    }    VbufFree( &prefix );    return( strrev( VbufString( pvbuf ) ) );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:15,


示例20: itoa

char* itoa(int n, char* s, int b) {  static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";  int i=0, sign;  if ((sign = n) < 0) {    n = -n;  }  do {    s[i++] = digits[n % b];  } while ((n /= b) > 0);  if (sign < 0) {    s[i++] = '-';  }  s[i] = '/0';  return strrev(s);}
开发者ID:ottos,项目名称:ottos,代码行数:15,


示例21: main

int main(void){    char s[128], i, len;    while (scanf("%s", s)!=EOF) {	for (i = 0, len = 0; s[i]; i+=1, len+=1)		;        printf("in : %s/n", s);        strrev(s);        //strrev_utf8(s);        printf("out: %s/n", s);        strrev_r(s, 0, len-1);        printf("out: %s/n", s);    }    return 0;}
开发者ID:gs0622,项目名称:algo,代码行数:15,


示例22: TestMove

void TestMove( void ){    char            bufA[80] = "FoO baR gOoBeR bLaH";    char            bufB[80];    char            *bufPtr;    char            *newBuf;    int             status;    bufPtr = strcpy( bufB, "FoO baR" );         /* copy string */    VERIFY( bufPtr == bufB );    bufPtr = strcat( bufB, " gOoBeR bLaH" );    /* append the rest */    VERIFY( bufPtr == bufB );    status = strcmp( bufA, bufB );              /* check result */    VERIFY( status == 0 );    bufPtr = strset( bufB, 0x00 );              /* zero out buffer */    VERIFY( bufPtr == bufB );    bufPtr = strncpy( bufB, "ABCDEFGHIJ", 2 );  /* copy two bytes */    VERIFY( bufPtr == bufB );    bufPtr = strncat( bufB, "CDEFGHIJ", 3 );    /* copy three more */    VERIFY( bufPtr == bufB );    status = strcmp( bufB, "ABCDE" );           /* ensure only five bytes */    VERIFY( status == 0 );    bufPtr = strnset( bufB, 0x00, 10 );         /* blank string */    VERIFY( bufPtr == bufB );    status = strcmp( bufB, "" );                /* verify empty */    VERIFY( status == 0 );    bufPtr = strcpy( bufB, "abcdefghij" );      /* copy string */    VERIFY( bufPtr == bufB );    bufPtr = strrev( bufB );                    /* reverse it */    VERIFY( bufPtr == bufB );    status = strcmp( bufB, "jihgfedcba" );      /* ensure reversed ok */    VERIFY( status == 0 );    newBuf = strdup( bufA );                    /* duplicate string */    status = strcmp( bufA, newBuf );    VERIFY( status == 0 );}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:48,


示例23: bin

void bin( char*string )  {	char a[17];	char str[8];	char nstr[6];	int i,j;	int num;	int cas;	if(strlen(string) == 4) cas = 8; //0x00	if(strlen(string) == 6) cas = 16; //0x0000	if( string[0] != '0' && string[1] != 'x') return;	num = strtol(string,NULL,16) ;		i = num;	memset(a,0,17);	while (num != 0) 	{		memset(str,0,8);		sprintf (str,"%d",num % 2); 		num = num /2;		strcat(a,str);			}		if( i == 0)	{		memset(a,'0',cas);	}		else	{		if(strlen(a) < cas)		{			for(j = strlen(a); j < cas; j++)			{				a[j] = '0';				//printf("oh yeah ");			}		}	}		printf("%s/n",strrev(a) );	//printf("%s/n", a);}
开发者ID:cuu,项目名称:cuu.github.com,代码行数:48,


示例24: stringMethod

SOM_Scope string  SOMLINK stringMethod(MemoryManagement *somSelf,  Environment *ev,                                        string inParameter, string* outParameter,                                        string* inOutParameter){    MemoryManagementData *somThis = MemoryManagementGetData(somSelf);    MemoryManagementMethodDebug("MemoryManagement","stringMethod");#if (defined(__MEMORY_MGMT_OBJECT_OWNED__) || defined(__MEMORY_MGMT_DUAL_OWNED__))   /* Check to see if any of the parameters are currently allocated, in some      instances, the server code may want to reuse the storage, but since this is a      sample, the memeory will simply be freed and realloced */      if (somThis->saveReturnString != NULL) SOMFree(somThis->saveReturnString);      if (somThis->saveInString != NULL) SOMFree(somThis->saveInString);      if (somThis->saveOutString != NULL) SOMFree(somThis->saveOutString);      if (somThis->saveInOutString != NULL) SOMFree(somThis->saveInOutString);#endif    string retVal = (char *)SOMMalloc(strlen(inParameter) +                              strlen(*inOutParameter) +                              1);    strcpy(retVal, inParameter);    strcat(retVal, *inOutParameter);/*************************************************************************** * NOTE: When an unbounded string is passed as the value in an inout method parameter * the returned value is constrained to be no longer than the input value. **************************************************************************/    strupr(*inOutParameter);    string tempString = (char *)SOMMalloc(strlen(inParameter) + 1);    strcpy(tempString, inParameter);    strrev(tempString); // Reverse the string    *outParameter = tempString;#if (defined(__MEMORY_MGMT_OBJECT_OWNED__) || defined(__MEMORY_MGMT_DUAL_OWNED__))   /* Save pointers to the storage so that they can be freed or reused later */   somThis->saveReturnString = retVal;   somThis->saveInString = inParameter;   somThis->saveOutString = *outParameter;   somThis->saveInOutString = *inOutParameter;#endif    return(retVal);}
开发者ID:OS2World,项目名称:DEV-SAMPLES-SOM-IBM,代码行数:48,


示例25: itoa

char* itoa(int v){	char result[100];	int idx = -1;	while(true)	{		if(v==0)			break;				result[++idx]=(v%10)+'0';		v/=10;	}	result[++idx]='/0'; 	strrev(result);	return result;} 
开发者ID:imgosari,项目名称:acm,代码行数:16,


示例26: hex

void hex(int a){    int r,i;    char h[15];    for(i=0; a>0; i++,a/=16)    {        r=a%16;        if(r<10)            h[i]=(char)r+48;        else            h[i]=(char)r+55;    }    h[i]='/0';    strrev(h);    puts(h);}
开发者ID:vivekzhere,项目名称:learning_cpp,代码行数:16,


示例27: task_four

//!=====================================================================void task_four(void){    char my_str[INF_STR];    printf("/n=====================================================/n");    printf("Here you can see the program that inverts words in stroke/n");    printf("Type your stroke/n");    scanf(" ");    gets(my_str);    int len = 0;    len = strlen(my_str);    int thebegin = 0, theend = 0, word = NO;    for(int i = 0; i < len; ++i)    {        assert( 0 <= i && i < len);        char work = ' ';        char safe = 0;        if (isalpha(my_str[i]) && word == NO)        {            thebegin = i;            word = YES;        }        if ( (isspace(my_str[i]) || my_str[i+1] == '/0') && word == YES)        {            theend = i - 1;            word = NO;            safe = my_str[i];            my_str[i] = '/0';            if (my_str[i+1] == 0)                my_str[i] = safe;            strrev(my_str+thebegin);            my_str[i] = work;        }    }    printf ("you got: <%s>/n", my_str);    puts(my_str);    printf("If you want to continue, type number of the next task/n");    printf("If you want to exit, type 11/n");}
开发者ID:TheAviat0r,项目名称:my-brain-work-out,代码行数:48,


示例28: main

int main(){//number of lychrel numbersunsigned long lychrel;unsigned long b=1,f=1;unsigned long test=10;char buf[40];char flip [40];unsigned long sum=0;unsigned long i=test,j=0;while(i<20){  /* converts initial test case to a string called buf */  sprintf(buf, "%lu", test);  /* flip the string */  strrev(buf,flip);  /* convert the strings to integers */  b = atoi(buf);  f = atoi(flip);  printf("testing %lu: ",i);  /*test the numbers */  if(j==5){  //possibly lychrel!    printf("%lu is possibly lychrel after %lu iterations",i,j);    j=0; //reset tester counter    i++; //try a new number!    test=i;    }  if((f==b)&&(j!=5)){   //definitely not a lychrel number; move on!    printf("%lu is NOT lychrel after %lu iterationsi. ",i,j);    printf(" This is because %lu = %lu/n",b,j);    j=0; //reset tester counter    i++; //try a new number!    test=i;    }  else{       //add the two numbers    sum=b+f;    printf("%lu+%lu=%lu, testing new candidate/n",b,f,sum);    //sets sum to the new test candidate    test=sum; //new test number!    j++;      //increment the iteration counter.    }  }  return 0;}
开发者ID:kd0skh,项目名称:projectEuler,代码行数:47,


示例29: main

int main(){    char str[20],str1[20];    scanf("%s",str);    strcpy(str1,str);    strrev(str1);    int i,j,n,k=0,l=0;    n=strlen(str);    char res[n][n];        for(i=0;i<n;i++)    {        for(j=0;j<n;j++)        {            if(i==(n/2)&&j==(n/2))            {                res[i][j]=str[k];                k++;                l++;            }            else if(i==j)            {                res[i][j]=str[k];                k++;            }            else if((n-1-i)==j)            {                res[i][j]=str1[l];                l++;            }            else            {                res[i][j]=NULL;            }        }    }        for(i=0;i<n;i++)        {            for(j=0;j<n;j++)            {                printf("%c  ",res[i][j]);            }            printf("/n");        }    return 0;}
开发者ID:vinithkannan,项目名称:Zoho-Enrich,代码行数:47,


示例30: _CLongInt__loadstr

CLongInt _CLongInt__loadstr(char * arg_0){	char * local_00;	int local_01;	int local_02;	int local_03;	char local_04[100];	CLongInt local_05;	local_05.m_intarray[0]=0;	local_05.m_int2=0;	local_02=0;	for ( ; !(*arg_0==0)&&(int)*arg_0==32; arg_0++) {	}	local_03=strlen(arg_0);	if (local_03==0) {		local_05.m_intarray[1]=0;		local_05.m_int1=0;		local_05.m_int2=0;		return local_05;	}	if ((int)*arg_0==45) {		local_05.m_int2=-1;		local_02=local_02+1;	}	if ((int)*arg_0==43) {		local_02=local_02+1;	}	strcpy(local_04,arg_0+local_02);	local_00=local_04;	local_00=strrev(local_00);	local_03=local_03-local_02;	for (local_01=0; local_01<local_03; local_01++) {		if (isdigit((int)*(local_00+local_01))==0) break;		*(local_00+local_01)-='0';	}	local_03=local_01;	local_02=1;	local_01=0;	while (local_01<local_03) {		local_05.m_intarray[local_02]=(int)*(local_00+local_01)+(int)*((local_00+1)+local_01)*10;		local_02=local_02+1;		local_01=local_01+2;	}	local_05.m_int1=local_02-1;	return local_05;}
开发者ID:Cartman0,项目名称:Winny-p2p,代码行数:46,



注:本文中的strrev函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ strreverse函数代码示例
C++ strreplace函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。