void CCharShape::PrintNode (size_t idx) const { TCharNode *node = Nodes[idx]; PrintInt ("node: ", (int)node->node_name); PrintInt ("parent: ", (int)node->parent_name); PrintInt ("child: ", (int)node->child_name); PrintInt ("next: ", (int)node->next_name); }
void CCharShape::PrintNode (int idx) { TCharNode *node = Nodes[idx]; PrintInt ("node: ",node->node_name); PrintInt ("parent: ", node->parent_name); PrintInt ("child: ", node->child_name); PrintInt ("next: ", node->next_name); }
void HTTPPrint_onOffCommand(void) { int channelNo = GetChannelNumberWithChannelTypeCheck(ONOFF_W_KEY); if (!channelNo) channelNo = GetChannelNumberWithChannelTypeCheck(ONOFF_W_BUTTON); if (!channelNo) channelNo = GetChannelNumberWithChannelTypeCheck(ONOFF_COMMAND); if (!channelNo) channelNo = GetChannelNumberWithChannelTypeCheck(ONOFF_PULSE); if (channelNo) { if (channels[channelNo - 1].channelType == ONOFF_COMMAND || channels[channelNo - 1].channelType == ONOFF_PULSE) { PrintInt(channels[channelNo -1].channelStatus.onOffCommand.pinCommand); } else { PrintInt(channels[channelNo -1].channelStatus.onOff.channelPins.pinCommand); } } else { TCPPutROMString(sktHTTP, NOT_DEF_STR); } }
void DisplayPNames(void) { char Word[15]; int i,k; /* int kk; */ long l; Print(27,22,0,15,SuchStr); for (i=0;i<22;i++) { if (i>=PNames) Print(2,i+2,0,15," "); else { Entry=E; Entry+=PName[Pos+i].Num; if (Entry->Mark==1) k=1; else k=0; if (k==0) PrintInt(2,i+2,0,15,Pos+i+1); else PrintInt(2,i+2,HGR,15,Pos+i+1); memset(Word,32,15); strcpy(Word,Entry->RName); Word[strlen(Word)]=32; Word[14]=0; if (k==0) Print(7,i+2,0,15,Word); else Print(7,i+2,HGR,15,Word); l=Entry->RLength; if (k==0) PrintZahl(16,i+2,0,15,l); else PrintZahl(16,i+2,HGR,15,l); } } PrintInt(2,CPos,7,15,Pos+CPos-1); Entry=E; Entry+=PName[Pos+CPos-2].Num; memset(Word,32,15); strcpy(Word,Entry->RName); Word[strlen(Word)]=32; Word[14]=0; Print(7,CPos,7,15,Word); l=Entry->RLength; PrintZahl(16,CPos,7,15,l); DisplayInfo(); i=PName[Pos+CPos-2].UsedInTex; if (i<999) Print(55,8,0,7,TEntry[PName[Pos+CPos-2].UsedInTex].TName); }
/* print a double to a stream without using printf/sprintf */ void PrintFP(double Num, struct OutputStream *Stream) { int Exponent = 0; int MaxDecimal; if (Num < 0) { PrintCh('-', Stream); Num = -Num; } if (Num >= 1e7) Exponent = log10(Num); else if (Num <= 1e-7 && Num != 0.0) Exponent = log10(Num) - 0.999999999; Num /= pow(10.0, Exponent); PrintInt((long)Num, 0, FALSE, FALSE, Stream); PrintCh('.', Stream); Num = (Num - (long)Num) * 10; if (abs(Num) >= 1e-7) { for (MaxDecimal = 6; MaxDecimal > 0 && abs(Num) >= 1e-7; Num = (Num - (long)(Num + 1e-7)) * 10, MaxDecimal--) PrintCh('0' + (long)(Num + 1e-7), Stream); } else PrintCh('0', Stream); if (Exponent != 0) { PrintCh('e', Stream); PrintInt(Exponent, 0, FALSE, FALSE, Stream); } }
/******************************************************************************* * LGScene::writeToFile *******************************************************************************/ int LGScene::writeToFile (char* cpFilename) { FILE* fpFile; // Output file // Open output file if (!(fpFile = fopen (cpFilename, "wb"))) { // Print error printf ("Error opening file: %s", cpFilename); // Return error return (-1); } // Print header id PrintChunkID (fpFile, "SCN"); // Print chunk size PrintInt (fpFile, LGScene::getChunkSize ()); // Print number of objects PrintInt (fpFile, LGScene::iNrOfObjects); // Print objects for (int iCount = 0; iCount < LGScene::iNrOfObjects; iCount++) { // Write object LGScene::opObjects[iCount].write (fpFile); } // Close file fclose (fpFile); // Return no error return (0); }
void PrintFloat(float val) { //always prints 5 places int i = val*100; int pflag = 0; int thous = i/10000; int hund = i/1000 - thous*10; int tenth = i/100 - thous*100 - hund*10; int dectenth = i/10 - thous*1000 - hund*100 - tenth*10; int dechund = i/1 - thous*10000 - hund*1000 - tenth*100 - dectenth*10; if(thous && !pflag){ PrintInt(thous); pflag = 1; } else{ PrintString(" "); } if(hund){ PrintInt(hund); pflag = 1; } else{ PrintString(" "); } PrintInt(tenth); PrintString("."); PrintInt(dectenth); PrintInt(dechund); }
int main() { CyGlobalIntDisable; isr_sw_StartEx(SW_Int); CyGlobalIntEnable; /* Enable global interrupts */ UART_1_Start(); Timer_1_Start(); Timer_2_Start(); for(;;) { if(press == 2){ time_s = abs(seconds_new - seconds_old)/1000; time_ms = (ms_old + 24000 - ms_new); UART_1_UartPutString("\n \r Time Between Presses: "); PrintInt(time_s); UART_1_UartPutString("."); PrintInt(time_ms); UART_1_UartPutString(" s"); press = 0; } } }
int main() { int array[SIZE], i, k, sum; unsigned start_time, end_time; start_time = GetTime(); for (k=0; k<OUTER_BOUND; k++) { for (i=0; i<SIZE; i++) sum += array[i]; PrintInt(k); } end_time = GetTime(); PrintChar('\n'); PrintString("Total sum: "); PrintInt(sum); PrintChar('\n'); PrintString("Start time: "); PrintInt(start_time); PrintString(", End time: "); PrintInt(end_time); PrintString(", Total time: "); PrintInt(end_time-start_time); PrintChar('\n'); return 0; }
void DisplayFiles(void) { char Word[17]; /* long l; */ int i; Print(27,22,0,15,SuchStr); Print(18,1,1,1," "); if (Dateien==0) { for (i=0;i<22;i++) Print(2,i+2,0,15," "); return; } Datai=Da; Datai+=Pos; for (i=0;i<22;i++) { if (i>=Dateien) Print(2,i+2,0,15," "); else { PrintInt(2,i+2,0,15,Pos+i+1); memset(Word,32,16); strcpy(Word,Datai->FileName); Word[strlen(Word)]=32; Word[15]=0; Print(7,i+2,0,15,Word); if (Datai->Date==0) Print(19,i+2,0,15,"DIR"); Datai++; } } PrintInt(2,CPos,7,15,Pos+CPos-1); Datai=Da; Datai+=Pos+CPos-2; memset(Word,32,16); strcpy(Word,Datai->FileName); Word[strlen(Word)]=32; Word[15]=0; Print(7,CPos,7,15,Word); if (Datai->Date==0) Print(19,CPos,7,15,"DIR"); }
int main(void){ int a = 1; int b = 2; int c = 3; PrintInt(FiveTimes(a)); PrintInt(FiveTimes(b)); PrintInt(FiveTimes(c)); return 0; }
int main() { int a=1,b=2,c=3; PrintInt(FiveIimes(a)); PrintInt(FiveIimes(b)); PrintInt(FiveIimes(c)); return 0; }
void CCharShape::PrintAction (int idx) { if (idx < 0 || idx >= numNodes) return; TCharAction *act = Actions[idx]; PrintInt (act->num); for (int i=0; i<act->num; i++) { PrintInt (act->type[i]); PrintDouble (act->dval[i]); PrintVector (act->vec[i]); } }
int main(int argc, char **argv) { int a = 1, b = 2, c = 3; PrintInt(FiveTimes(a)); PrintInt(FiveTimes(b)); PrintInt(FiveTimes(c)); return 0; }
void CCharShape::PrintAction (size_t idx) const { if (idx >= numNodes) return; TCharAction *act = Nodes[idx]->action; PrintInt ((int)act->num); for (size_t i=0; i<act->num; i++) { PrintInt (act->type[i]); PrintDouble (act->dval[i]); PrintVector (act->vec[i]); } }
void CAStreamBasicDescription::PrintToLog(const AudioStreamBasicDescription& inDesc) { PrintFloat (" Sample Rate: ", inDesc.mSampleRate); Print4CharCode (" Format ID: ", inDesc.mFormatID); PrintHex (" Format Flags: ", inDesc.mFormatFlags); PrintInt (" Bytes per Packet: ", inDesc.mBytesPerPacket); PrintInt (" Frames per Packet: ", inDesc.mFramesPerPacket); PrintInt (" Bytes per Frame: ", inDesc.mBytesPerFrame); PrintInt (" Channels per Frame: ", inDesc.mChannelsPerFrame); PrintInt (" Bits per Channel: ", inDesc.mBitsPerChannel); }
int main (void) { unsigned int data[2]; Init(); while(1) { LineData(data); PrintInt(data[LEFT]); SerPrint("\n"); PrintInt(data[RIGHT]); SerPrint("\n\n\n"); Msleep(500); } }
int main() { int n; int arr[N_MAX]; int i, j; PrintString("Nhap N (N <= 100): "); n = ReadInt(); while (n == 0 || n > 100) { PrintString("So nhap khong hop le, vui long nhap lai: "); n = ReadInt(); } /* Input N integers */ for (i = 0; i < n; i++) { PrintString("Nhap vao so nguyen thu "); PrintInt(i+1); PrintString(": "); arr[i] = ReadInt(); while (arr[i] == 0) { PrintString("Nhap khong hop le, vui long nhap lai: "); arr[i] = ReadInt(); } } /* Bubble sort */ for (i = 0; i < n - 1; i++) { /* Last i integers are already sorted */ for (j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { /* Swap two integers */ arr[j] ^= arr[j + 1]; arr[j + 1] ^= arr[j]; arr[j] ^= arr[j + 1]; } } } /* Print N sorted integers */ PrintString("Day so da sap xep:\n"); for (i = 0; i < n - 1; i++) { PrintInt(arr[i]); PrintString(", "); } /* Last integer */ PrintInt(arr[n - 1]); PrintString(".\n"); return 0; }
void ManagerCountMoney(int* appMoney, int* picMoney, int* passMoney, int* cashMoney) { int i; /* for loops */ int total; /* total money */ Acquire(moneyLock); for(i = 0; i < NUM_APPCLERKS; i++) { *appMoney += GetMV(appClerkMoney, i); SetMV(appClerkMoney, i, 0); } Acquire(outputLock); Print("Manager has counted a total of $", 32); PrintInt((*appMoney) * 10); Print(" for Application Clerks.\n", 25); Release(outputLock); for(i = 0; i < NUM_PICCLERKS; i++) { *picMoney += GetMV(picClerkMoney, i); SetMV(picClerkMoney, i, 0); } Acquire(outputLock); Print("Manager has counted a total of $", 32); PrintInt((*picMoney) * 10); Print(" for Picture Clerks.\n", 21); Release(outputLock); for(i = 0; i < NUM_PASSCLERKS; i++) { *passMoney += GetMV(passClerkMoney, i); SetMV(passClerkMoney, i, 0); } Acquire(outputLock); Print("Manager has counted a total of $", 32); PrintInt((*passMoney) * 10); Print(" for Passport Clerks.\n", 22); Release(outputLock); for(i = 0; i < NUM_CASHIERS; i++) { *cashMoney += GetMV(cashierMoney, i); SetMV(cashierMoney, i, 0); } Acquire(outputLock); Print("Manager has counted a total of $", 32); PrintInt((*cashMoney) * 10); Print(" for Cashiers.\n", 15); Release(outputLock); total = *appMoney + *picMoney + *passMoney + *cashMoney; Acquire(outputLock); Print("Manager has counted a total of $", 32); PrintInt(total*10); Print(" for the Passport Office.\n", 26); Release(outputLock); Release(moneyLock); }
main() { int n; for (n=20;n<=25;n++) PrintInt(n); }
int main() { int i, sum=0; for (i=0; i<2*SIZE1/3; i++) sum += array1[i]; for (i=0; i<SIZE1/3; i++) sum += array1[i]; for (i=2*SIZE1/3; i<SIZE1; i++) sum += array1[i]; for (i=SIZE1/3; i<2*SIZE1/3; i++) sum += array1[i]; for (i=0; i<2*SIZE2/3; i++) sum += array2[i]; for (i=0; i<SIZE2/3; i++) sum += array2[i]; for (i=2*SIZE2/3; i<SIZE2; i++) sum += array2[i]; for (i=SIZE2/3; i<2*SIZE2/3; i++) sum += array2[i]; for (i=0; i<2*SIZE3/3; i++) sum += array3[i]; for (i=0; i<SIZE3/3; i++) sum += array3[i]; for (i=2*SIZE3/3; i<SIZE3; i++) sum += array3[i]; for (i=SIZE3/3; i<2*SIZE3/3; i++) sum += array3[i]; for (i=0; i<2*SIZE4/3; i++) sum += array4[i]; for (i=0; i<SIZE4/3; i++) sum += array4[i]; for (i=2*SIZE4/3; i<SIZE4; i++) sum += array4[i]; for (i=SIZE4/3; i<2*SIZE4/3; i++) sum += array4[i]; PrintString("Total sum: "); PrintInt(sum); PrintChar('\n'); return 0; }
/** * \brief Draws local high score menu. * * Uses the values saved in the topscores array, not eeprom values, this allows displaying scores separately from saving/loading. */ void drawLocalHighScoreMenu(void) { //set cursor for use with this menu (may one day be needed for scrolling) menu_x = fakemod((drawX+9),VRAM_TILES_H); menu_y = 15; ClearVram(); //blank screen drawFrame(); //draw generic gui frame Print(fakemod((drawX+6),VRAM_TILES_H),3,PSTR("LOCAL TOP SCORES:")); //write menu title at top of screen for(u8 i = 0; i < 10; i++) //print scores 1 - 10 from topscores array { PrintInt(fakemod((drawX+17),VRAM_TILES_H),6+(i<<1),topscores[i], false); PrintInt(fakemod((drawX+11),VRAM_TILES_H),6+(i<<1),i+1, false); Print(fakemod((drawX+12),VRAM_TILES_H),6+(i<<1),PSTR(".")); } }
void test_emem(void) { int data_rd; int data_wr,i; data_wr = 0xAA; for(i=0; i < EE_SIZE; i+=100) { E2Write(data_wr,i); E2Read((char *)&data_rd,i); if((data_rd & 0xFF) != data_wr) { PrintString( (UINT8 const *)"\n\rTEST EEPROM FAIL!!: ADDRESS=" ); PrintInt((UINT32)i); return; } } data_wr = 0xAA55AA55; EditWriteMagic(data_wr); E2BlockRead((char *)&data_rd,EE_MAGIC_ADDRESS,EE_MAGIC_SIZE); if (data_rd!=data_wr) { PrintString( (UINT8 const *)"\n\rTEST EEPROM FAIL!!: MAGIC ADDRESS" ); return; } PrintString( (UINT8 const *)"\n\rTEST EEPROM PASS" ); }
int main() { uint16_t a; int rv; uint8_t x; uart_init(); i2c_init(); /*for compass*/ uint8_t buf; double angle=0; uint16_t angle1=0; hmc5883_init(); Prints("hmc5883_init ok!\n\r"); while(1) { buf = 0x00; write_bytes(0x02,1,&buf); angle=CompassAngle(0,0,0); angle1=angle; Prints("Azimuth="); PrintInt(angle1/10); uart_putchar('.'); PrintUchar(angle1%10); _delay_ms(300); } return 0; }
void DisplayPatch(void) { char Word[15]; int i; /* long l; */ Print(2,1,1,15,"Num Name �"); Print(25,9,1,15,"�����������������������������������������������������"); Print(22,10,1,15," � Texture-Patch-Directory �"); Print(25,11,1,15,"���������������������������������������������������Ŀ"); Print(25,17,1,15,"�����������������������������������������������������"); for (i=12;i<17;i++) { Print(25,i,1,15,"�"); Print(77,i,1,15,"�"); } Print(26,12,1,11," RET - View texture Esc - Abort "); Print(26,13,1,11," F1 - List patches F2 - Add texture patch "); Print(26,14,1,11," "); Print(26,15,1,11," "); Print(26,16,1,11," "); Print(22,18,1,15," � �"); Print(22,19,1,15," � �"); Print(25,20,1,15,"����������������Ŀ "); Print(25,21,1,15,"�"); Print(26,21,1,11," Search string: "); Print(42,21,1,15,"� "); Print(25,22,1,15,"� "); Print(27,22,0,7," "); Print(41,22,1,15," � "); Print(25,23,1,15,"������������������ "); Print(27,22,0,15,SuchStr); Print(27,7,0,15,"Type:"); Print(55,7,0,15,"Patches:"); Print(27,8,0, 7,"Texture data [ "); Print(1,1,1,1," "); for (i=0;i<22;i++) { PrintInt(2,i+2,0,15,TPos+i+1); memset(Word,32,15); strcpy(Word,TEntry[i+TPos].TName); Word[strlen(Word)]=32; Word[14]=0; Print(7,i+2,0,15,Word); Print(16,i+2,0,15," "); } PrintInt(2,TCPos,7,15,TPos+TCPos-1); memset(Word,32,15); strcpy(Word,TEntry[TPos+TCPos-2].TName); Word[strlen(Word)]=32; Word[15]=0; Print(7,TCPos,7,15,Word); fseek(f,(long)(TEntry[TPos+TCPos-2].TStart+12),0); _read(fileno(f),&Tx,2); _read(fileno(f),&Ty,2); Print(27,8,0, 7,"Texture data [ "); PrintInt2(41,8,0,7,Tx); Print(44,8,0,7,","); PrintInt2(45,8,0,7,Ty); Print(48,8,0,7,"]"); _read(fileno(f),&i,2); _read(fileno(f),&i,2); _read(fileno(f),&Tn,2); PrintInt(55,8,0,7,Tn); }
int main() { int n; for (n=9;n>5;n--) { PrintInt(n); } }
int main() { Cents cCents(7); PrintInt(cCents); // print 7 Dollars cDollars(9); PrintCents(cDollars); // cDollars will be cast to a Cents return 0; }
main() { int n ; for( n = 1 ; n < 50 ; ++n ){ if( n%13 == 0 ) Sleep(5); else PrintInt(3); // to indicate this is test3 runing } }
main() { int n ; for( n = 1; n < 80 ; ++n ){ if( n%11 == 0 ) Sleep(4); else PrintInt(4); // indicate this is test4 running } }
main() { int n; for( n = 1 ; n < 20 ; n++ ) { if( n%5 == 3 ) Sleep(3); else PrintInt(5); } }