当前位置: 首页>>代码示例>>C++>>正文


C++ printdata函数代码示例

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


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

示例1: procget

/* perform get command */
static int procget(const char *path, const char *pkbuf, int pksiz, int omode, bool px, bool pz){
  TCTDB *tdb = tctdbnew();
  if(g_dbgfd != INVALID_HANDLE_VALUE) tctdbsetdbgfd(tdb, g_dbgfd);
  if(!tctdbsetcodecfunc(tdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(tdb);
  if(!tctdbopen(tdb, path, TDBOREADER | omode)){
    printerr(tdb);
    tctdbdel(tdb);
    return 1;
  }
  bool err = false;
  TCMAP *cols = tctdbget(tdb, pkbuf, pksiz);
  if(cols){
    tcmapiterinit(cols);
    const char *kbuf;
    int ksiz;
    while((kbuf = tcmapiternext(cols, &ksiz)) != NULL){
      int vsiz;
      const char *vbuf = tcmapiterval(kbuf, &vsiz);
      printdata(kbuf, ksiz, px);
      putchar('\t');
      printdata(vbuf, vsiz, px);
      putchar(pz ? '\t' : '\n');
    }
    tcmapdel(cols);
  } else {
    printerr(tdb);
    err = true;
  }
  if(!tctdbclose(tdb)){
    if(!err) printerr(tdb);
    err = true;
  }
  tctdbdel(tdb);
  return err ? 1 : 0;
}
开发者ID:hsn10,项目名称:tokyocabinet-win,代码行数:36,代码来源:tctmgr.c

示例2: proclist

/* perform list command */
static int proclist(const char *path, int omode, bool pv, bool px){
  TCHDB *hdb = tchdbnew();
  if(g_dbgfd >= 0) tchdbsetdbgfd(hdb, g_dbgfd);
  if(!tchdbopen(hdb, path, HDBOREADER | omode)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  bool err = false;
  if(!tchdbiterinit(hdb)){
    printerr(hdb);
    err = true;
  }
  TCXSTR *key = tcxstrnew();
  TCXSTR *val = tcxstrnew();
  while(tchdbiternext3(hdb, key, val)){
    printdata(tcxstrptr(key), tcxstrsize(key), px);
    if(pv){
      putchar('\t');
      printdata(tcxstrptr(val), tcxstrsize(val), px);
    }
    putchar('\n');
  }
  tcxstrdel(val);
  tcxstrdel(key);
  if(!tchdbclose(hdb)){
    if(!err) printerr(hdb);
    err = true;
  }
  tchdbdel(hdb);
  return err ? 1 : 0;
}
开发者ID:kadoma,项目名称:fms,代码行数:33,代码来源:tchmgr.c

示例3: main

int main(void){
  int i;

  printf("N?");
  scanf("%d", &N);
  /*1~10000の乱数を発生させ、Bubble[], Quick[]に格納*/
  srand((unsigned int)time(0));
  for(i = 0; i < N; i++){
    Bubble[i] = Quick[i] = rand() % 10000 + 1;
  }
  printf("Input: ");
  for(i = 0; i < N; i++){
    printf("%d ", Bubble[i]);
    if(i % 10 == 9){
      printf("\n");
    }
  }
  printf("\n");

  /*****BubbleSort*****/
  printf("Bubble Sort start\n");
  bubblesort();  /*Bubble[0]~Bubble[N-1]をソート*/
  printf("Bubble Sort end: ");
  printdata(Bubble);  /*バブルソートの結果出力*/

  /*****QuickSort*****/
  printf("Quick Sort start\n");
  quicksort(0, N-1);  /*Quick[0]~Quick[N-1]をソート*/
  printf("Quick Sort end: ");
  printdata(Quick);  /*クイックソートの結果出力*/
  
  return 0;
}
开发者ID:camberbridge,项目名称:Algorithm_DataStructure,代码行数:33,代码来源:BQsort.c

示例4: main

int main(){
    apop_data *d = apop_text_alloc(apop_data_alloc(6), 6, 1);
    apop_data_fill(d,   1,   2,   3,   3,   1,   2);
    apop_text_fill(d,  "A", "A", "A", "A", "A", "B");

    asprintf(&d->names->title, "Original data set");
    printdata(d);

        //binned, where bin ends are equidistant but not necessarily in the data
    apop_data *binned = apop_data_to_bins(d, NULL);
    asprintf(&binned->names->title, "Post binning");
    printdata(binned);
    assert(apop_sum(binned->weights)==6);
    assert(fabs(//equal distance between bins
              (apop_data_get(binned, 1, -1) - apop_data_get(binned, 0, -1))
            - (apop_data_get(binned, 2, -1) - apop_data_get(binned, 1, -1))) < 1e-5);

        //compressed, where the data is as in the original, but weights 
        //are redome to accommodate repeated observations.
    apop_data_pmf_compress(d);
    asprintf(&d->names->title, "Post compression");
    printdata(d);
    assert(apop_sum(d->weights)==6);

    apop_model *d_as_pmf = apop_estimate(d, apop_pmf);
    Apop_row(d, 0, firstrow); //1A
    assert(fabs(apop_p(firstrow, d_as_pmf) - 2./6 < 1e-5));
}
开发者ID:ClinImmune,项目名称:Apophenia,代码行数:28,代码来源:binning.c

示例5: proclist

/* perform list command */
static int proclist(const char *path, int omode, int max, bool pv, bool px,
                    const char *rlstr, const char *rustr, const char *ristr){
  TCFDB *fdb = tcfdbnew();
  if(g_dbgfd >= 0) tcfdbsetdbgfd(fdb, g_dbgfd);
  if(!tcfdbopen(fdb, path, FDBOREADER | omode)){
    printerr(fdb);
    tcfdbdel(fdb);
    return 1;
  }
  bool err = false;
  if(rlstr || ristr){
    TCLIST *keys = ristr ? tcfdbrange5(fdb, ristr, max) : tcfdbrange3(fdb, rlstr, rustr, max);
    for(int i = 0; i < tclistnum(keys); i++){
      int ksiz;
      const char *kbuf = tclistval(keys, i, &ksiz);
      printf("%s", kbuf);
      if(pv){
        int vsiz;
        char *vbuf = tcfdbget2(fdb, kbuf, ksiz, &vsiz);
        if(vbuf){
          putchar('\t');
          printdata(vbuf, vsiz, px);
          tcfree(vbuf);
        }
      }
      putchar('\n');
    }
    tclistdel(keys);
  } else {
    if(!tcfdbiterinit(fdb)){
      printerr(fdb);
      err = true;
    }
    int cnt = 0;
    uint64_t id;
    while((id = tcfdbiternext(fdb)) > 0){
      printf("%llu", (unsigned long long)id);
      if(pv){
        int vsiz;
        char *vbuf = tcfdbget(fdb, id, &vsiz);
        if(vbuf){
          putchar('\t');
          printdata(vbuf, vsiz, px);
          tcfree(vbuf);
        }
      }
      putchar('\n');
      if(max >= 0 && ++cnt >= max) break;
    }
  }
  if(!tcfdbclose(fdb)){
    if(!err) printerr(fdb);
    err = true;
  }
  tcfdbdel(fdb);
  return err ? 1 : 0;
}
开发者ID:childhood,项目名称:TSDocDB,代码行数:58,代码来源:tcfmgr.c

示例6: main

main()
{
	struct node* head = build123();
	Push(&head, 0);
	printdata(head);
	InsertNth( &head, 0, 299);
	printdata(head);
	InsertNth( &head, 3, 845);
	printdata(head);
}
开发者ID:syamgk,项目名称:Data_Structures,代码行数:10,代码来源:5_insertNth.c

示例7: proclist

/* perform list command */
static int proclist(const char *path, int omode, int max, bool pv, bool px, const char *fmstr){
  TCHDB *hdb = tchdbnew();
  if(g_dbgfd >= 0) tchdbsetdbgfd(hdb, g_dbgfd);
  if(!tchdbsetcodecfunc(hdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(hdb);
  if(!tchdbopen(hdb, path, HDBOREADER | omode)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  bool err = false;
  if(fmstr){
    TCLIST *keys = tchdbfwmkeys2(hdb, fmstr, max);
    for(int i = 0; i < tclistnum(keys); i++){
      int ksiz;
      const char *kbuf = tclistval(keys, i, &ksiz);
      printdata(kbuf, ksiz, px);
      if(pv){
        int vsiz;
        char *vbuf = tchdbget(hdb, kbuf, ksiz, &vsiz);
        if(vbuf){
          putchar('\t');
          printdata(vbuf, vsiz, px);
          tcfree(vbuf);
        }
      }
      putchar('\n');
    }
    tclistdel(keys);
  } else {
    if(!tchdbiterinit(hdb)){
      printerr(hdb);
      err = true;
    }
    TCXSTR *key = tcxstrnew();
    TCXSTR *val = tcxstrnew();
    int cnt = 0;
    while(tchdbiternext3(hdb, key, val)){
      printdata(tcxstrptr(key), tcxstrsize(key), px);
      if(pv){
        putchar('\t');
        printdata(tcxstrptr(val), tcxstrsize(val), px);
      }
      putchar('\n');
      if(max >= 0 && ++cnt >= max) break;
    }
    tcxstrdel(val);
    tcxstrdel(key);
  }
  if(!tchdbclose(hdb)){
    if(!err) printerr(hdb);
    err = true;
  }
  tchdbdel(hdb);
  return err ? 1 : 0;
}
开发者ID:Fleurer,项目名称:nanodb,代码行数:56,代码来源:tchmgr.c

示例8: main

main()
{
	struct node* head = build123();
	printdata(head);
	printf("0th element is %d \n",GetNth(head,0));
	printf("value = %d\n",pop(&head));
	printdata(head);
	printf("value = %d\n",pop(&head));
	printdata(head);
	printf("value = %d\n",pop(&head));
	printdata(head);
	printf("value = %d\n",pop(&head));
	printdata(head);
}
开发者ID:syamgk,项目名称:Data_Structures,代码行数:14,代码来源:4_pop.c

示例9: series_view_refresh

void series_view_refresh (GtkWidget *w, windata_t *vwin)
{
    series_view *sview = (series_view *) vwin->data;

    if (sview != NULL && sview->varnum > 0 && sview->varnum < dataset->v) {
	int list[2] = {1, sview->varnum};
	PRN *prn = NULL;
	int err;

	if (bufopen(&prn)) {
	    return;
	}

	err = printdata(list, NULL, dataset, OPT_O, prn);

	if (err) {
	    gui_errmsg(err);
	    gretl_print_destroy(prn);
	} else {
	    /* replace text buffer in sview using prn */
	    const char *buf = gretl_print_get_trimmed_buffer(prn);

	    textview_set_text(vwin->text, buf);
	    gretl_print_destroy(prn);
	}
    }
}
开发者ID:HelioGuilherme66,项目名称:gretl,代码行数:27,代码来源:series_view.c

示例10: multi_series_view_print

static void multi_series_view_print (windata_t *vwin)
{
    series_view *sview = (series_view *) vwin->data;
    PRN *prn;
    int err = 0;

    if (bufopen(&prn)) {
	return;
    }

    if (sview->view == VIEW_STANDARD) {
	err = printdata(sview->list, NULL, dataset, OPT_O, prn);
    } else {
	err = print_series_with_format(sview->list, dataset, 
				       sview->format, sview->digits, 
				       prn);
    } 

    if (err) {
	gui_errmsg(err);
    } else {
	textview_set_text(vwin->text, gretl_print_get_trimmed_buffer(prn));
    }

    gretl_print_destroy(prn);
}
开发者ID:HelioGuilherme66,项目名称:gretl,代码行数:26,代码来源:series_view.c

示例11: bubblesort

void bubblesort(){
  int i, j, tmp;

  for(i = 0; i < N-1; i++){  /*配列の要素分だけ回す*/
    for(j = N-1; j > i; j--){  /*配列の末尾から先頭へじゅんぐり*/
      if(Bubble[j-1] > Bubble[j]){  /*前に位置する要素の方が大き
                                     *かったら入れ替える*/
        tmp = Bubble[j];
        Bubble[j] = Bubble[j-1];
        Bubble[j-1] = tmp;
        printdata(Bubble);
      }
    }
    printdata(Bubble);
  }
}
开发者ID:camberbridge,项目名称:Algorithm_DataStructure,代码行数:16,代码来源:BQsort.c

示例12: procget

/* perform get command */
static int procget(const char *path, const char *kbuf, int ksiz, int omode, bool px, bool pz){
  TCFDB *fdb = tcfdbnew();
  if(g_dbgfd >= 0) tcfdbsetdbgfd(fdb, g_dbgfd);
  if(!tcfdbopen(fdb, path, FDBOREADER | omode)){
    printerr(fdb);
    tcfdbdel(fdb);
    return 1;
  }
  bool err = false;
  int vsiz;
  char *vbuf = tcfdbget2(fdb, kbuf, ksiz, &vsiz);
  if(vbuf){
    printdata(vbuf, vsiz, px);
    if(!pz) putchar('\n');
    tcfree(vbuf);
  } else {
    printerr(fdb);
    err = true;
  }
  if(!tcfdbclose(fdb)){
    if(!err) printerr(fdb);
    err = true;
  }
  tcfdbdel(fdb);
  return err ? 1 : 0;
}
开发者ID:childhood,项目名称:TSDocDB,代码行数:27,代码来源:tcfmgr.c

示例13: sample_MiniMU9

void sample_MiniMU9() //Main Loop
{
  if((millis()-timer)>=100) //20 // Main loop runs at 50Hz
  {
    counter++;
    timer_old = timer;
    timer=millis();
    if (timer>timer_old)
      G_Dt = (timer-timer_old)/1000.0;    // Real time of loop run. We use this on the DCM algorithm (gyro integration time)
    else
      G_Dt = 0;
    
    // *** DCM algorithm
    // Data adquisition
    Read_Gyro();   // This read gyro data
    Read_Accel();     // Read I2C accelerometer
    
    if (counter > 5)  // Read compass data at 10Hz... (5 loop runs)
      {
      counter=0;
      Read_Compass();    // Read I2C magnetometer
      Compass_Heading(); // Calculate magnetic heading  
      }
    
    // Calculations...
    Matrix_update(); 
    Normalize();
    Drift_correction();
    Euler_angles();
    // ***
   
    printdata();
  }
   
}
开发者ID:atomicpunk,项目名称:openrov-software,代码行数:35,代码来源:MinIMU9AHRS.cpp

示例14: printdata

static void
printdata(size_t level, const void *v, size_t x, size_t l)
{
	const uint8_t *p = v, *ep = p + l;
	size_t ox;
	char buf[128];

	while (p + x < ep) {
		const uint8_t *q;
		uint8_t c = getclass(p[x]);
		uint8_t t = gettype(p[x]);
		ox = x;
		if (x != 0)
		printf("%.2x %.2x %.2x\n", p[x - 1], p[x], p[x + 1]);
		uint32_t tag = gettag(p, &x, ep - p + x);
		if (p + x >= ep)
			break;
		uint32_t len = getlength(p, &x, ep - p + x);
		
		printf("%zu %zu-%zu %c,%c,%s,%u:", level, ox, x,
		    der_class[c], der_type[t],
		    der_tag(buf, sizeof(buf), tag), len);
		q = p + x;
		if (p + len > ep)
			errx(EXIT_FAILURE, "corrupt der");
		printtag(tag, q, len);
		if (t != DER_TYPE_PRIMITIVE)
			printdata(level + 1, p, x, len + x);
		x += len;
	}
}
开发者ID:guybiecher,项目名称:Tornado,代码行数:31,代码来源:der.c

示例15: gibbsandMHloop

int gibbsandMHloop(int iter,int thin,gsl_rng *RNG,struct_data *D,struct_para *D_para,struct_priors *D_priors ,struct_MH *D_MH,int print){
  int i,j,l,c,ll;
  /* print=3;*/
    if (print==0){printheader(D);}
  for (i=0;i<iter;i++){
    for (j=0;j<thin;j++){
      /*       printf("%g\n",D_para->sigma_Z);*/
      /*      printf("%g %g %g\n",D_para->delta_l[2412],D_para->delta_l[3593],D_para->delta_l[4211]);*/
      D_para->alpha_c[1]=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_nu,&D_MH->halpha_c,D_para->alpha_c[1],MCMC_alpha_c,-999,-999,-999);
      D_para->sigma_gamma=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hsigma_gamma,D_para->sigma_gamma,MCMC_sigma_gamma,-999,-999,-999);      
      D_para->sigma_nu=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hsigma_nu,D_para->sigma_nu,MCMC_sigma_nu,-999,-999,-999);
      D_para->Z_p=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hZ_l,D_para->Z_p,MCMC_Z_p,-999,-999,-999);
      D_para->sigma_Z=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hsigma_Z,D_para->sigma_Z,MCMC_sigma_Z,-999,-999,-999);   
      D_para->nu_p=gauss_sample(RNG,D,0,2*D->L,D_para->nu_l,exp(D_para->sigma_nu),D_priors->nu_mu,D_priors->eta_nu_p);

      for (l=0;l<D->L;l++){
	D_para->delta_l[l]=aug_delta_l(RNG,D,D_para,D_priors,l);
	D_para->gamma_cl[l]=MCMC_base_truncate_low(0,RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hgamma_cl,exp(D_para->gamma_cl[l]),MCMC_gamma_cl,-999,l,-999);
	D_para->gamma_cl[l]=log( D_para->gamma_cl[l]);
	D_para->Z_l[l]=MCMC_base_truncate_low(0,RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hZ_l,exp(D_para->Z_l[l]),MCMC_Z_l,-999,l,-999);
	D_para->Z_l[l]=log( D_para->Z_l[l]);
	for (c=0;c<2;c++){
	  ll=c*D->L+l;
	  D_para->nu_l[ll]=MCMC_base(RNG,D,D_para,D_priors,&D_MH->accept_Z,&D_MH->hnu_l,D_para->nu_l[ll],MCMC_nu_l,c,l,-999);
	}
      }
    }
    if (print==1){printdata(D,D_para,D_MH);}
  }

  return 0;
}
开发者ID:jhncl,项目名称:Model-in-C,代码行数:32,代码来源:functions.c


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