当前位置: 首页>>代码示例>>C++>>正文


C++ digit函数代码示例

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


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

示例1: large

node1 *radix_sort(node1 *rec)
{
	node1 *r, *nex;
	int poc = 0 ;
	int i, j, k;
	int larg = large(rec);
	int m = numdig(larg);

	/* These statements create pockets */

	for(k = 0 ; k < 10; k++)
	{
		pocket[k] = (node1 *)malloc(sizeof(node1));
		pocket1[k] = (node1 *)malloc(9*sizeof(node1));
	}

	/* These statements initialize pockets */

	for(j = 1; j <= m ; j++)
	{
		for(i = 0 ; i < 10 ; i++)
		{
			pocket[i] = NULL;
			pocket1[i] = NULL ;
		}

		r = rec ;
		while(r != NULL)
		{
			int dig = digit(r->data, j);
			nex = r->next ;
			update(dig,r);
			r = nex;
		}

		if(r!= NULL)
		{
			int dig = digit(r->data,j);
			update(dig,r);
		}

		while(pocket1[poc] == NULL)
			poc ++;
		rec = Make_link(poc, rec);
	}
	return(rec);
}
开发者ID:deepak12cs46,项目名称:Data-Structure-Lab,代码行数:47,代码来源:RADIX.C

示例2: maknew

char *
maknew(char *str)
{
	/* make two numerical fields */
	int c;
	char *dpoint, *p, *q, *ba;
	p = str;
	for (ba= 0; c = *str; str++)
		if (c == '\\' && *(str+1)== '&')
			ba=str;
	str=p;
	if (ba==0)
		{
		for (dpoint=0; *str; str++)
			{
			if (*str=='.' && !ineqn(str,p) &&
				(str>p && digit(*(str-1)) ||
				digit(*(str+1))))
					dpoint=str;
			}
		if (dpoint==0)
			for(; str>p; str--)
			{
			if (digit( * (str-1) ) && !ineqn(str, p))
				break;
			}
		if (!dpoint && p==str) /* not numerical, don't split */
			return(0);
		if (dpoint) str=dpoint;
		}
	else
		str = ba;
	p =str;
	if (exstore ==0 || exstore >exlim)
		{
		exstore = chspace();
		exlim= exstore+MAXCHS;
		}
	q = exstore;
	ba = exstore + MAXSTR;
	do {
		if (exstore > ba)
			error(gettext("numeric field too big"));
	} while (*exstore++ = *str++);
	*p = 0;
	return(q);
}
开发者ID:andreiw,项目名称:polaris,代码行数:47,代码来源:tm.c

示例3: insertParentProxy

/*void
insertParentProxy(ConfigVariablePtr var,AtomPcharKey=(unsigned char*)key;tr av)          //add
{
    AtomPtr atom;
    atom=*var->value.a;
    while(1){
       //if(!atom->next)break;
       if(strcmp(atom->string,av->string)==0)return;
       if(!atom->next)break;
       atom=atom->next;
    }
    av->next=atom->next;
    atom->next=av;
    //av->next=*var->value.a;
    //*var->value.a=av;
    return;
}*/
static
int
parseAtom1(char *buf, int offset, AtomPtr *value_return, int insensitive)
{
    int y0, i, j, k;
    AtomPtr atom;
    int escape = 0;
    char *s;

    i = offset;
    if(buf[i] != '\0') {
        y0 = i;
        i++;
        while(buf[i] != '\"' && buf[i] != '\n' && buf[i] != '\0' && buf[i]!=',') {
            if(buf[i] == '\\' && buf[i + 1] != '\0') {
                escape = 1;
                i += 2;
            } else
                i++;
        }
        //if(buf[i] != '\0')
            //return -1;
        j = i ;
    } else {
        y0 = i;
        while(letter(buf[i]) || digit(buf[i]) || 
              buf[i] == '_' || buf[i] == '-' || buf[i] == '~' ||
              buf[i] == '.' || buf[i] == ':' || buf[i] == '/')
            i++;
        j = i;
    }

    if(escape) {
        s = malloc(i - y0);
        if(buf == NULL) return -1;
        k = 0;
        j = y0;
        while(j < i) {
            if(buf[j] == '\\' && j <= i - 2) {
                s[k++] = buf[j + 1];
                j += 2;
            } else
                s[k++] = buf[j++];
        }
        if(insensitive)
            atom = internAtomLowerN(s, k);
        else
            atom = internAtomN(s, k);
        free(s);
        j++;
    } else {
        if(insensitive)
            atom = internAtomLowerN(buf + y0, i - y0);
        else
            atom = internAtomN(buf + y0, i - y0);
    }
    *value_return = atom;
    return j;
}
开发者ID:bigbadnad,项目名称:socialproxy,代码行数:76,代码来源:social.c

示例4: insertR

	void insertR(link& h, T x, int d){
		int i = digit(x.key(), d);
		if(i == 0) h = new node(i);
		if(i == NULLdigit) return;
		if(i < h->d) insertR(h->l, x, d);
		if(i == h->d) insertR(h->m, x, d);
		if(i > h->d) insertR(h->r, x, d);
	}
开发者ID:GaZpaR,项目名称:self-education,代码行数:8,代码来源:tst.cpp

示例5: number

void number (int a, int base) {
  n=1;
  while (base<a/n+1) n*=base;
  while (n) {  
    digit (a/n);
    a%=n; n/=base;
  } 
}
开发者ID:TimofonicJunkRoom,项目名称:Oldies,代码行数:8,代码来源:pcx.c

示例6: main

int main(void)
{
    int num=12345678, pos=5;
    printf("Posicion %d de %d es %d\n", pos, num, digit(pos, num) );
    printf("Posicion %d de %d es %d\n", pos, num, digit_v2(pos, num) );
    system("pause"); // Detiene la consola
  
}
开发者ID:Hydex,项目名称:asi-iesenlaces,代码行数:8,代码来源:digito.cpp

示例7: number

void number (int a, int base) {
  i=1;
  while (base<a/i+1) i*=base;
  while (i) {  
    digit (a/i);
    a%=i; i/=base;
  } 
}
开发者ID:TimofonicJunkRoom,项目名称:Oldies,代码行数:8,代码来源:testeold.c

示例8: getdigit

int getdigit(char c) { int i;
    lexval=0; lexval=c-'0'; /*lexval=int hi=0, c=char*/
    if (thechar=='x') thechar='X'; if (thechar=='X') { next();
      while(letter(thechar)) { c=next(); if(c>96) c=c-39;
	if (c>64) c=c-7; c=c-48; lexval=lexval << 4; /* *16 */ 
     i=0; i=c; lexval=lexval+i;}
    }else { while(digit(thechar)) { c=next(); c=c-48; lexval=lexval*10; 
     i=0; i=c; lexval=lexval+i; } } 
}
开发者ID:ALANGUAGE,项目名称:A2011,代码行数:9,代码来源:A88.C

示例9: searchR

	T searchR(link h, key v, int d){
		if(h == 0) return nullItem;
		key t = h->item.key();
		if(v == t) return h->item();
		if(digit(v, d) == 0)
			return searchR(h->l, v);
		else
			return searchR(h->r, v);
	}
开发者ID:GaZpaR,项目名称:self-education,代码行数:9,代码来源:dst.cpp

示例10: TestError

 void tdc::enableFIFO()
 {
   unsigned int DATA;  
   TestError(readData(ControlRegister, &DATA),"TDC: Enabling the FIFO");
   if (digit(DATA,8)==0) {
     DATA+=0x0100;}
   TestError(writeData(ControlRegister, &DATA),"TDC: Enabling the FIFO");
   if(vLevel(NORMAL))cout<<"FIFO enabled !"<<endl;
 }
开发者ID:BrieucF,项目名称:CosmicTrigger,代码行数:9,代码来源:TDC.cpp

示例11: Convert_n

//===================================================================
BYTE Convert_n(BYTE n)
{
	BYTE i,s=0;
	for(i=0;i<8;i++)
	{
		s|=digit(n,i)<<(7-i);
	}
	return s;
}
开发者ID:alex262,项目名称:MB90F591,代码行数:10,代码来源:NDD21.c

示例12: countdown

// graphics_open(3*w,62);	
int countdown(int strt, int fin, int br, int bg, int bb, int dr, int dg, int db, int m, int w)
{
	int i,j,d1,d2,d3;
	while(BCHK); // debounce
	for(i=strt;i>=fin;i--) {
		graphics_fill(br,bg,bb);
		d1=i/100; d2=(i%100)/10; d3=i%10;
		if (d1>0) digit(d1,m,dr,dg,db);
		if (d1>0 || d2>0) digit(d2,m+w,dr,dg,db);
		digit(d3,m+w+w,dr,dg,db);
		graphics_update();
		for (j=0;j<4;j++) { // pause 1 second or quit
			if(BCHK) return 1;
			msleep(250);
		}
	}
	return 0;	
}
开发者ID:42ms,项目名称:kipr-table_program_2015,代码行数:19,代码来源:numeric_countdown.c

示例13: decimal

unsigned long int decimal(char *ptr)
{
    unsigned long result = 0;

    while (*ptr) {
	result *= 10;
	result += digit(*ptr++);
    }
    return result;
}
开发者ID:Edwin-Edward,项目名称:elks,代码行数:10,代码来源:partype.c

示例14: faster

 /**
  * Figure out the answer numerically to each of the digit locations
  */
 long faster()
 {
    int digits[] = {9, 90*2, 900*3, 9000*4, 90000*5, 900000*6};
    int answer = 1;
    for (int ii = 1; ii <= 1000000; ii *= 10)
    {
       answer *= digit(ii,digits);
    }
    return answer;
 }
开发者ID:amclauth,项目名称:Euler,代码行数:13,代码来源:P040.cpp

示例15: pat_search

/* Returns the node matching the key or its prefix */
static patricia *
pat_search(patricia *node, im_key key, int bit)
{
  assert(node);

  if (node->bit <= bit)
    return node;
  else
    return pat_search(node->links[digit(key, node->bit)], key, node->bit);
}
开发者ID:Syntroth,项目名称:redpill_mush,代码行数:11,代码来源:intmap.c


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