本文整理汇总了C++中printline函数的典型用法代码示例。如果您正苦于以下问题:C++ printline函数的具体用法?C++ printline怎么用?C++ printline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
int number;
char buf [ 1024 * 1024 ] __attribute__ ((unused)); /* Try to uncover bugs. */
Line *line, **lline, *lines;
lines = NULL;
lline = &lines;
number = 0;
while (1) {
printline ("%6d> ", number + 1);
//printline ("testmtcp.c: ABOUT TO malloc\n");fflush(stdout);
#ifdef USE_STATIC_MALLOC
line = mymalloc (sizeof *line);
#else
line = malloc (sizeof *line);
#endif
//printline ("testmtcp.c: DID malloc\n");fflush(stdout);
if (!readline (line -> buff, sizeof line -> buff)) break;
*lline = line;
line -> next = NULL;
lline = &(line -> next);
printline ("\n");
number = 0;
for (line = lines; line != NULL; line = line -> next) {
printline ("%6d: %s", ++ number, line -> buff);
}
}
//mtcp_no ();
printline ("All done!\n");
exit (0);
return (0);
}
示例2: main
main()
{
NODEPTR *tree;
int ch;int j=0;
//int number;
*tree=NULL;
while(1){
printline('*');
printf("Enter the choice:-");
printf("\n1.Insert the element\n2.Delete the element\n3.Traversal\n4.call function\n");
scanf("%d",&ch);
printline('=');
switch(ch){
case 1:
insert(tree);break;
case 2:
// delete();break;
case 3:
traversal(*tree);break;
case 4:printf("\nEnter the no u want to smallest\n");
scanf("%d",&j);
printf("\n%d\n",kthMin(*tree,&j));printline('*');break;
default:
printf("Hi i m default");
break;
}/*end of switch*/
}/*end of while*/
}/*end of main*/
示例3: skip_backward
// prepare to skip forward a certain # of frames backward and continue playing forward
// do not call skip_backward directly
bool ldp::pre_skip_backward(Uint16 frames_to_skip)
{
bool result = false;
// only skip if the LDP is playing
if (m_status == LDP_PLAYING)
{
Uint16 target_frame = (Uint16) (m_uCurrentFrame - frames_to_skip);
unsigned int uOldCurrentFrame = m_uCurrentFrame;
m_iSkipOffsetSincePlay -= frames_to_skip;
result = skip_backward(frames_to_skip, target_frame);
char s[81];
snprintf(s, sizeof(s), "Skipped backward %d frames (from %u to %u)", frames_to_skip, uOldCurrentFrame, target_frame);
printline(s);
}
else
{
printline("LDP ERROR: Skip backward command was called when the disc wasn't playing");
}
return(result);
}
示例4: append
void append(struct Inventory item[],int num, FILE *file){
int n;
printline();
printf("Enter the amount of items to add\n");
scanf("%d",&n);
printline();
printf("Enter Inventory Data :\n");
printline();
for (int i=num; i<(num+n); i++) {
printf("\nFor Item %d :\n\n",i+1);
printf("Enter the Name of the Item\n");
scanf("%s",item[i].name);
printf("Enter the Item Number\n");
scanf("%d",&item[i].number);
printf("Enter the price of Item\n");
scanf("%f",&item[i].price);
printf("Enter the Quantity of Item\n");
scanf("%d",&item[i].quantity);
}
printline();
for (int i=num; i<(num+n); i++) {
fwrite(&item[i],sizeof(item[i]),1,file);
}
}
示例5: DelRec
/* Funkcija ierakstu dzesanai */
int DelRec(void) {
unsigned short int inputId; // Lietotāja inputs
if(ReadDB() == EXIT_SUCCESS) { // Izvadam visus ierakstus
printline("Enter ID of book you want to delete:");
scanf("%hu",&inputId);
__fpurge(stdin);
{
int my_rec, v_yes_no;;
while(
//Ejam cauri visiem atrastajiem ierakstiem (bet vajadzētu būt tikai vienam)
(my_rec =
searchElement( offsetof( struct book_rec_type, id)
//, member_size( struct book_rec_type, id)
, (int*)&inputId,
UNSIGNED_SHORT_INT )
) >= 0) {
// Prasam vai dzēst ierakstu
v_yes_no = askForConfirmation();
if(v_yes_no == 1)
//Dzēšam ierakstu
if(removeRecord(my_rec) == EXIT_SUCCESS)
printline("The record has been successfully removed");
}
}
}
示例6: debug_disassemble
// print a disassembly starting from addr
void debug_disassemble(unsigned int addr)
{
char s[160] = { 0 };
int line = 0;
const char *name = NULL;
// print this many lines because that's how many our console can show at a time
while (line < 13)
{
name = g_game->get_address_name(addr); // check to see if this address has a name
// if so, it's a label name, so print it
if (name)
{
outstr(name);
printline(":");
line++;
}
sprintf(s, "%04x: ", addr);
outstr(s);
addr += get_cpu_struct(g_which_cpu)->dasm_callback(s, addr);
printline(s);
line++;
}
}
示例7: fault_handler
void fault_handler ( struct regs *r )
{
if ( r->int_no < 32 )
{
printline ( exception_messages[r->int_no] );
printline ( "Exception, System halted" );
}
}
示例8: main
main() {
printf("Input Array: ");
display();
printline(50);
selectionSort();
printf("Output Array: ");
display();
printline(50);
}
示例9: main
main() {
printf("Input Array: ");
display();
printline(50);
quickSort(0,MAX-1);
printf("Output Array: ");
display();
printline(50);
return0
}
示例10: printline
bool ldp::pre_change_speed(unsigned int uNumerator, unsigned int uDenominator)
{
string strMsg;
// if this is >= 1X
if (uDenominator == 1)
{
m_uFramesToStallPerFrame = 0; // don't want to stall at all
// if this isn't 0 ...
if (uNumerator > 0)
{
m_uFramesToSkipPerFrame = uNumerator - 1; // show 1, skip the rest
}
// else it's 0, which is illegal (use pause() instead unless the game driver specifically wants to do this, in which case more coding is needed)
else
{
m_uFramesToSkipPerFrame = 0;
printline("ERROR : uNumerator of 0 sent to pre_change_speed, this isn't supported, going to 1X");
}
}
// else if this is < 1X
else if (uNumerator == 1)
{
m_uFramesToSkipPerFrame = 0; // don't want to skip any ...
// protect against divide by zero
if (uDenominator > 0)
{
m_uFramesToStallPerFrame = uDenominator - 1; // show 1, stall for the rest
}
// divide by zero situation
else
{
m_uFramesToStallPerFrame = 0;
printline("ERROR : uDenominator of 0 sent to pre_change_speed, this is undefined, going to 1X");
}
}
// else it's a non-standard speed, so do some kind of error
else
{
strMsg = "ERROR : unsupported speed specified (" + numstr::ToStr(uNumerator) +
"/" + numstr::ToStr(uDenominator) + "), setting to 1X";
uNumerator = uDenominator = 1;
}
bool bResult = change_speed(uNumerator, uDenominator);
if (bResult) strMsg = "Successfully changed ";
else strMsg = "Unable to change ";
strMsg += "speed to " + numstr::ToStr(uNumerator) + "/" + numstr::ToStr(uDenominator) +
"X";
printline(strMsg.c_str());
return bResult;
}
示例11: zn_shell_echo
int zn_shell_echo(command *cmd)
{
int retval = 0;
const char* output = command_next_arg(cmd);
if (output) {
printline(output);
} else {
printline("");
}
return retval;
}
示例12: drawstatus
/*
* Draw the status information in the status window.
*/
static void
drawstatus(void)
{
long score;
long allsteps;
long games;
score = 0;
games = games0[index];
allsteps = steps0[index];
score += games1[index];
games += games1[index];
allsteps += steps1[index];
score += games2[index] * 2;
games += games2[index];
allsteps += steps2[index];
printline(0, "Size: %2d\n", size);
printline(1, "Mines: %3d\n", mines);
PRINTSTEPS;
printline(3, "Legs: %d\n", legs);
printline(5, "Won games: %3d\n", games2[index]);
printline(6, "1-leg games:%3d\n", games1[index]);
printline(7, "Lost games: %3d\n", games0[index]);
if (games) {
printline(9, "Legs/game: %3d.%03d\n", score / games,
((score * 1000) / games) % 1000);
printline(10, "Steps/game:%3d.%03d\n", allsteps / games,
((allsteps * 1000) / games) % 1000);
}
}
示例13: main
int main(void)
{
char line[MAXLINE];
while(getline(line,MAXLINE) > 0)
{
//printf("%s\n", line);
printline(line);
}
printline(line);
return 0;
}
示例14: listing_printline
/*
* listing_printline
*
* General print routine or use by hooks in other modules.
*/
void
listing_printline (void *ctx, const char *buf, size_t len, int align_with_source)
{
char outbuf[132];
if (align_with_source) {
if (len > 132-16) len = 132-16;
memset(outbuf, ' ', 16);
memcpy(outbuf+16, buf, len);
printline(ctx, outbuf, len+16);
} else {
if (len > 132) len = 132;
printline(ctx, buf, len);
}
} /* listing_printline */
示例15: modtmpdb
void modtmpdb(struct resistor *resistor_db_tmp, int *tamanho_db){
unsigned int index, num;
printf("Entre com o INDICE desejado para modifica-lo\n");
do{
scanf("%u", &index);
} while(index >= *tamanho_db +2);
index--;
printf(HEADER_DB);
printline(resistor_db_tmp, index);
printf("Qual a nova quantidade? \n");
scanf("%u", &resistor_db_tmp[index].qtd);
printf(HEADER_DB);
printline(resistor_db_tmp, index);
}