• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ digit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: do_msd_radixsort

void do_msd_radixsort(item_t *array,int left,int right,int w)
{
	int n=right-left+1;
	item_t *aux;
	int count[R+1];
	int i;

	if(right-left+1<=1 || w>=bytesword){
		return;
	}


	for(i=0;i<=R;i++){
		count[i]=0;
	}

	for(i=left;i<=right;i++){
		count[digit(array[i],w)+1]++;
	}

	for(i=1;i<=R;i++){
		count[i]+=count[i-1];
	}


	aux=malloc(n*sizeof(*aux));

	for(i=left;i<=right;i++){
		copy_item(&aux[count[digit(array[i],w)]++],&array[i]);
	}

	for(i=left;i<=right;i++){
		copy_item(&array[i],&aux[i-left]);	
	}

	free(aux);

	
	do_msd_radixsort(array,left,left+count[0]-1,w+1);
	for(i=1;i<R;i++){
		do_msd_radixsort(array,left+count[i-1],left+count[i]-1,w+1);		
	}
}
开发者ID:algking,项目名称:Algorithms-in-C-Sedgewick,代码行数:43,代码来源:E10.33_radix_sort_lsd_format.c


示例17: insertion_sort_radix

void insertion_sort_radix(item_t *array,int left,int right,int w)
{
    int i,j;
    item_t t;

    for(i=left+1; i<=right; i++) {
        copy_item(&t,&array[i]);

        for(j=i; j>left; j--) {
            if(digit(array[j-1],w)<=digit(t,w)) {
                break;
            }

            copy_item(&array[j],&array[j-1]);
        }

        copy_item(&array[j],&t);
    }
}
开发者ID:keezen,项目名称:Algorithms-in-C-Sedgewick,代码行数:19,代码来源:E10.38_radix_sort_lsd_rearrange.c


示例18: expand

static void
expand(char *as)
{
	char *cs;
	char *sgpathp, *oldcs;
	struct stat stb;

	sgpathp = gpathp;
	cs = as;
	if (*cs == '~' && gpathp == gpath) {
		addpath('~');
		for (cs++; letter(*cs) || digit(*cs) || *cs == '-';)
			addpath(*cs++);
		if (!*cs || *cs == '/') {
			if (gpathp != gpath + 1) {
				*gpathp = 0;
				if (gethdir(gpath + 1)) {
					(void)sprintf(errstring = errbuf,
					"Unknown user name: %s after '~'",
					gpath+1);
					globerr = IPS;
				}
				strcpy(gpath, gpath + 1);
			} else
				strcpy(gpath, home);
			gpathp = strend(gpath);
		}
	}
	while (!any(*cs, globchars) && globerr == 0) {
		if (*cs == 0) {
			if (!globbed)
				Gcat(gpath, "");
			else if (stat(gpath, &stb) >= 0) {
				Gcat(gpath, "");
				globcnt++;
			}
			goto endit;
		}
		addpath(*cs++);
	}
	oldcs = cs;
	while (cs > as && *cs != '/')
		cs--, gpathp--;
	if (*cs == '/')
		cs++, gpathp++;
	*gpathp = 0;
	if (*oldcs == '{') {
		(void)execbrc(cs, ((char *)0));
		return;
	}
	matchdir(cs);
endit:
	gpathp = sgpathp;
	*gpathp = 0;
}
开发者ID:joshuaeckroth,项目名称:cadr,代码行数:55,代码来源:glob.c


示例19: ParseDouble

double ParseDouble ( char **str )
{
    double num ;

    /*
       Skip nonnumeric stuff.  If we run into a comma, that means missing data.
    */

    while (! ( digit ( **str ) || (**str == '-') || (**str == '.'))) {
        if (**str == ',') {
            ++(*str) ;
            return MISSING ;  // In CONST.H
        }
        if (**str)
            ++(*str) ;
        else
            return MISSING ;
    }

    /*
       Read the number, then pass it by
    */

    num = atof ( *str ) ;

    while (digit ( **str )  ||  (**str == '-')  ||  (**str == '.'))
        ++(*str) ;

    /*
       Skip a single comma that may be a delimiter
    */

    while ((**str == ' ')  ||  (**str == ',')) {
        if (**str == ',') {
            ++(*str) ;
            break ;
        }
        ++(*str) ;
    }

    return num ;
}
开发者ID:abishekahluwaila,项目名称:read,代码行数:42,代码来源:PARSDUBL.CPP


示例20: set_number

	inline bool set_number(unsigned int &_num) {
		unsigned int num = 0;
		for(unsigned int i = 0; i < n; ++i) {
			unsigned int d;
			if(!digit(c[i], d))
				return false;
			num = num * 10 + d;
		}
		_num = num;
		return true;
	}
开发者ID:MarishaYasko,项目名称:phantom,代码行数:11,代码来源:time.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ digitalPinToBitMask函数代码示例发布时间:2022-05-30
下一篇:
C++ difftime函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap