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

C++ printNumber函数代码示例

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

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



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

示例1: main

int main(void){
	FILE *in;
	int i;

	/* Create file handle */
	if((in = fopen(FILENAME, "r")) == NULL){
		printf("Unable to open file '%s'\n", FILENAME);
		return 1;
	}
    
	/* Construct sum and current number lists */
    list *sum = malloc(sizeof(list));
    constructList(sum, LENGTH);
 	list *currNum = malloc(sizeof(list));
 	constructList(currNum, LENGTH);
	
	/* Compute the large number by repetitively loading the numbers from file and adding to sum */
	loadNumber(in, sum);
	for (i = 1; i < NUMBERS; i++) {
		loadNumber(in, currNum);
		addNumber(sum, currNum);
	}
	
	/* Print the first 10 digits of sum */
	printNumber(sum);

	/* Deconstruct all constructs */
    fclose(in);
 	destructList(sum);
    free(sum);
	free(currNum);
    
    return 0;
}
开发者ID:N8Stewart,项目名称:Euler,代码行数:34,代码来源:problem.c


示例2: write

void Print::print(unsigned long long n, int base) {
    if (base == BYTE) {
        write((uint8)n);
    } else {
        printNumber(n, base);
    }
}
开发者ID:heorohuy,项目名称:maple_mini_libmaple,代码行数:7,代码来源:Print.cpp


示例3: print

void Noritake_VFD_GU7000::print(long number, uint8_t base) {
    if (number < 0) {
        print('-');
        number = -number;
    }
    printNumber(number, base);
}
开发者ID:dwaxemberg,项目名称:hyperion,代码行数:7,代码来源:Noritake_VFD_GU7000.cpp


示例4: va_start

void Print::printf(const char *str, ...) {
  va_list args;
  va_start(args, str);
  while(uint8_t c = *str++) {
    switch(c) {
      case '%': {
        c = *str++;
        if(c) {
          switch(c) {
            // TODO
            case 'd': {
              int x = va_arg(args, int);
              printNumber(x, 10);
            } break;
            case 's': {
              const char *x = va_arg(args, const char *);
              print(x);
            } break;
            case '%': {
              write(c);
            } break;
            default: {
              write('%');
              write(c);
            };
          };
        } else {
          write('%');
        };
      } break;
      default: {
        write(c);
      } break;
    };
  };
开发者ID:Coaching,项目名称:powermeter,代码行数:35,代码来源:Print.cpp


示例5: main

int main() {
    int size = 0;
    char strNumber[9];
    scanf("%d %s", &size, strNumber);
    
    while (size != 0 || atoi(strNumber) != 0) {
        setLcdSize(size);
        int length = strlen(strNumber);
        
        int i;
        for (i = 0; i < length; i++) {
            int n = strNumber[i] - '0';
            printNumber(n, i);
        }
        
        for (i = 0; i < nLines; i++) {
            int n;
            for (n = 0; n < length; n++) {
                int j;
                for (j = 0; j < nColumns; j++) {
                    printf("%c", lcdNumbers[n][i][j]);
                }
                if (n < length - 1) {
                    printf(" "); //column of blanks
                }
            }
            printf("\n");
        }
        printf("\n");

        scanf("%d %s", &size, strNumber);
    }
    return 0;
}
开发者ID:JaDyali,项目名称:LCD-Display-ACM,代码行数:34,代码来源:LCD.cpp


示例6: printNumber

void Com::print(long value) {
    if(value<0) {
        HAL::serialWriteByte('-');
        value = -value;
    }
    printNumber(value);
}
开发者ID:pascallanger,项目名称:Repetier-Firmware,代码行数:7,代码来源:Communication.cpp


示例7: IF_show_stackV

void IF_show_stackV(void)
{
void * Next;
struct Var * N;
    Next = stackV;
    while (Next != VIDE) {
       N = (struct Var*) Next;
       printf(" %-25s : Type ",N->l);
       switch(N->t) {
          case VT_I :
            printf("initial (NULL)");
            break;
          case VT_B :
            printf("Boolean ");
            if (N->b) printf("TRUE"); else printf("FALSE");
            break;
          case VT_C :
            printf("String \"%s\"", (char*)N->a);
            break;
          case VT_N :
            printf("Number ");
            printNumber(N->a);
            break;
          case VT_L :
            printf("Lib. Fct. %s", libByAddr(N->a));
            break;
          case VT_F :
            printf("User Fct. %s", fctByAddr(N->a));
            break;
       }
       printf("\n");
       Next = N->n;
    }
    printf("<end of variable list>\n");
}
开发者ID:Kegeruneku,项目名称:nife,代码行数:35,代码来源:stackV.c


示例8: write

size_t Print::print(unsigned long n, int base)
{
	if (base == 0)
	{
		return write(n);
	}
	return printNumber(n, base);
}
开发者ID:dc42,项目名称:PanelDue,代码行数:8,代码来源:Print.cpp


示例9: print

void WaspXBee::print(long n)
{
  if (n < 0) {
    print('-');
    n = -n;
  }
  printNumber(n, 10);
}
开发者ID:aposada,项目名称:ASK-Shield,代码行数:8,代码来源:WaspXBee.cpp


示例10: printf

void printf(const char * msg, ...)
{
	unsigned char *memory = (unsigned char *)VIDEO_MEMORY;
	unsigned short i = 0;
	char c = ' ';

	unsigned char *p = (char*)&msg + sizeof(char*);
	while(1)
	{
		c = *(msg+(i++));
		if(c == '%')
		{
			char specifier = *(msg+(i++));
			switch(specifier)
			{
				case 'c':
					c = (unsigned char)*((int*)p);
					p += sizeof(int);
				break;
				case 'u':
					printNumber((unsigned int)*((int*)p), 10);
					p += sizeof(int);
					continue;
				case 'x':
					printNumber((unsigned int)*((int*)p), 16);
					p += sizeof(int);
					continue;
				case 's':
					printString((const unsigned char*)*((int*)p));
					p += sizeof(int);
					continue;
				default:
				break;
			}
		}
		else if(c == '\n')
		{
			nextLine();
			continue;
		}
		if(c == 0)
			break;
		putch(c);
		incrementCursor();
	}
}
开发者ID:randcode-generator,项目名称:RandCodeOS,代码行数:46,代码来源:stdio.c


示例11: print

void Print::print(long n)
{
  if (n < 0) {
    print('-');
    n = -n;
  }
  printNumber(n, 10);
}
开发者ID:binaryrobert85,项目名称:musicshield,代码行数:8,代码来源:Print.cpp


示例12: writeDecDigits

void writeDecDigits(text_t *p, int val, int width)
{
  if(val < 0) {
    val = -val;
    writeChar(p, '-');
  }
  printNumber(p, val, 10, width, ' ');
}
开发者ID:Redacacia,项目名称:BlocklyProp,代码行数:8,代码来源:writeDecDigits.c


示例13: printStack

void printStack(stack *stk){
  cell *top = stk->top;
  while(top != NULL){
    printNumber(top->number);
    putchar('\n');
    top = top->prev;
  }
}
开发者ID:DrPyser,项目名称:IFT2035-TP1,代码行数:8,代码来源:stack.c


示例14: print

void SWSerLCDpa::print(long n)
{
    if (n < 0) {
        print('-');
        n = -n;
    }
    printNumber(n, 10);
}
开发者ID:pfhendri,项目名称:arduino-rails,代码行数:8,代码来源:SWSerLCDpa.cpp


示例15: print

void SoftwareSerial::print(long n)
{
  if (n < 0) {
    print('-');
    n = -n;
  }
  printNumber(n, 10);
}
开发者ID:BackupTheBerlios,项目名称:arduino-svn,代码行数:8,代码来源:SoftwareSerial.cpp


示例16: printNumber

void printNumber(int n)	// for n > 0
{	// 1234567
	if(n)
	{
		printNumber(n/10);		// 214/10 = 21
		cout<<n%10;				// 214%10 = 4
	}
}
开发者ID:Hamadaabdrabou96,项目名称:ArabicCompetitiveProgramming,代码行数:8,代码来源:Algorithms_Misc_01_Recursion.cpp


示例17: main

int main(int argc, char const *argv[])
{
	int x;
	scanf("%d", &x);

	printNumber(x);
	printf("%s\n", "");
	return 0;
}
开发者ID:lostsquirrel,项目名称:c_demo,代码行数:9,代码来源:exercise_4.2.1.c


示例18: print

void Print::print(long n, int base)
{
  if (base == 0)
    print((char) n);
  else if (base == 10)
    print(n);
  else
    printNumber(n, base, 0);
}
开发者ID:LawrenceLeung,项目名称:arduino-makefile,代码行数:9,代码来源:Print.cpp


示例19: printGeneral

void printGeneral(parseTree curNode, FILE* fp)
{
    if(curNode->tk->sym < nNonTerminals)
        printNonTerminal(curNode, fp);
    else if(curNode->tk->sym == NUM || curNode->tk->sym == RNUM )
        printNumber(curNode, fp);
    else
        printTerminal(curNode, fp);
}
开发者ID:alasin,项目名称:compiler,代码行数:9,代码来源:parser.c


示例20: write

size_t Print::print(unsigned long long n, int base) {
size_t c=0;
    if (base == BYTE) {
        c= write((uint8)n);
    } else {
        c= printNumber(n, base);
    }
	return c;
}
开发者ID:KayvanGuo,项目名称:Arduino_STM32,代码行数:9,代码来源:Print.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ printOut函数代码示例发布时间:2022-05-30
下一篇:
C++ printMsg函数代码示例发布时间: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