本文整理汇总了C++中printNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ printNumber函数的具体用法?C++ printNumber怎么用?C++ printNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: write
void Print::print(unsigned long long n, int base) {
if (base == BYTE) {
write((uint8)n);
} else {
printNumber(n, base);
}
}
示例3: print
void Noritake_VFD_GU7000::print(long number, uint8_t base) {
if (number < 0) {
print('-');
number = -number;
}
printNumber(number, base);
}
示例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;
};
};
示例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;
}
示例6: printNumber
void Com::print(long value) {
if(value<0) {
HAL::serialWriteByte('-');
value = -value;
}
printNumber(value);
}
示例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");
}
示例8: write
size_t Print::print(unsigned long n, int base)
{
if (base == 0)
{
return write(n);
}
return printNumber(n, base);
}
示例9: print
void WaspXBee::print(long n)
{
if (n < 0) {
print('-');
n = -n;
}
printNumber(n, 10);
}
示例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();
}
}
示例11: print
void Print::print(long n)
{
if (n < 0) {
print('-');
n = -n;
}
printNumber(n, 10);
}
示例12: writeDecDigits
void writeDecDigits(text_t *p, int val, int width)
{
if(val < 0) {
val = -val;
writeChar(p, '-');
}
printNumber(p, val, 10, width, ' ');
}
示例13: printStack
void printStack(stack *stk){
cell *top = stk->top;
while(top != NULL){
printNumber(top->number);
putchar('\n');
top = top->prev;
}
}
示例14: print
void SWSerLCDpa::print(long n)
{
if (n < 0) {
print('-');
n = -n;
}
printNumber(n, 10);
}
示例15: print
void SoftwareSerial::print(long n)
{
if (n < 0) {
print('-');
n = -n;
}
printNumber(n, 10);
}