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

C++ print_函数代码示例

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

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



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

示例1: print_

void print_(Node *root) {
  if (root) {
    std::cout << root->data << " ";
    print_(root->left);
    print_(root->right);
  }
}
开发者ID:elinus,项目名称:CODE,代码行数:7,代码来源:Problem-13.cpp


示例2: jsonStart

void plotly::plot(unsigned long x, int y){
    jsonStart(len_(x)+len_(y));
    print_(x);
    jsonMiddle();
    print_(y);
    jsonEnd();
}
开发者ID:thecore64,项目名称:arduino-api,代码行数:7,代码来源:plotly_streaming_cc3000.cpp


示例3: reconnectStream

void plotly::plot(unsigned long x, int y, char *token){
    reconnectStream();
    jsonStart(len_(x)+len_(y));
    print_(x);
    jsonMiddle();
    print_(y);
    jsonEnd(token);
}
开发者ID:Joel-Therrien,项目名称:UML-Engineering-Camp,代码行数:8,代码来源:spark-plotly.cpp


示例4: while

void plotly::openStream() {
    //
    // Start request to stream servers
    //
    if(log_level < 3){} Serial.println(F("... Connecting to plotly's streaming servers..."));
    char server[] = "arduino.plot.ly";
    int port = 80;
    while ( !client.connect(server, port) ) {
        if(log_level < 4) Serial.println(F("... Couldn\'t connect to servers... trying again!"));
        fibonacci_ += fibonacci_;
        delay(min(fibonacci_, 60000));
    }
    fibonacci_ = 1;
    if(log_level < 3){} Serial.println(F("... Connected to plotly's streaming servers\n... Initializing stream"));

    print_(F("POST / HTTP/1.1\r\n"));
    print_(F("Host: arduino.plot.ly\r\n"));
    print_(F("User-Agent: Python\r\n"));
    print_(F("Transfer-Encoding: chunked\r\n"));
    print_(F("Connection: close\r\n"));
    if(convertTimestamp){
        print_(F("plotly-convertTimestamp: \""));
        print_(timezone);
        print_(F("\"\r\n"));
    }
    print_(F("\r\n"));

    if(log_level < 3){} Serial.println(F("... Done initializing, ready to stream!"));
}
开发者ID:Joel-Therrien,项目名称:UML-Engineering-Camp,代码行数:29,代码来源:spark-plotly.cpp


示例5: print_

void plotly::send_prepad_(){
  // print [[ or [ to the client if the start of the matrix or row 
  mi_ += 1;
  if(mi_ == 1){
      ni_ += 1;
      if(ni_==1){
          print_("[[",2);
      } else{
          print_("[",1);
      }
  }
}
开发者ID:ecoaspect,项目名称:arduino-api,代码行数:12,代码来源:plotly.pre.cpp


示例6: send_prepad_

void plotly::sendString_(float d){
    send_prepad_();
    char s_[width_];
    dtostrf(d,width_,prec_,s_);
    print_(s_,width_);
    send_postpad_();
}
开发者ID:ecoaspect,项目名称:arduino-api,代码行数:7,代码来源:plotly.pre.cpp


示例7: print_base16

void print_base16(void)

/* Write a function that prints all the numbers of base 16 from 0 to F */
{
  char c;
  for (c = '0'; c <= '9'; c = 'A'; c <= 'F'; ++c) /* Work in progress */
      print_(c);
}
开发者ID:asaiapalacios,项目名称:holbertonschool-low_level_programming,代码行数:8,代码来源:3-print_base16.c


示例8: print_

void plotly::jsonStart(int i){
    // Print the length of the message in hex:
    // 15 char for the json that wraps the data: {"x": , "y": }\n
    // + 23 char for the token: , "token": "abcdefghij"
    // = 38
    if(log_level<2) Serial.print(i+44, HEX);
    if(!dry_run) client.print(i+44, HEX);
    print_("\r\n{\"x\": ");
}
开发者ID:Joel-Therrien,项目名称:UML-Engineering-Camp,代码行数:9,代码来源:spark-plotly.cpp


示例9: dump

void MyArray<T>:: dump(std::ostream& os)
{
  os << "\nno of dimensions: " << ndim
     << "\nsizes: ";
  int i;
  for (i = 0; i < ndim; i++)
    os << size[i] << " ";
  os << "length: " << length << " ptr: " << A << std::endl;
  print_(os);
}
开发者ID:HunterAllman,项目名称:kod,代码行数:10,代码来源:MyArray.cpp


示例10: main

int main()
{
   int num,i;
   int a[10]={4,6,8,2,9,1,3,10,5,7};
  
   printf("please input one number from 0ne to five:\n");
   scanf("%d",&num);
   switch(num)
   {
       case 1: select_sort(a,10);print_(a,10);break;
	   case 2: insert_sort(a,10);print_(a,10);break;
	   case 3: bubble_sort(a,10);print_(a,10);break;
	   case 4: quick_sort(a,10);print_(a,10);break;
	   case 5: heap_sort(a,10);print_(a,10);break;
	   default: printf("input error");break;
   }
	
	return 0;
	
}
开发者ID:wy91092,项目名称:svn,代码行数:20,代码来源:main.c


示例11: while

void plotly::openStream() {
    //
    // Start request to stream servers
    //
    if(log_level < 3){} Serial.println(F("... Connecting to plotly's streaming servers..."));

    /*
    #define STREAM_SERVER "arduino.plot.ly"
    uint32_t stream_ip = 0;
    // Try looking up the website's IP address
    while (stream_ip == 0) {
        if (! cc3000.getHostByName(STREAM_SERVER, &stream_ip)) {
            if(log_level < 4){} Serial.println(F("Couldn't resolve!"));
        }
    }
    */
    uint32_t stream_ip = cc3000.IP2U32(54, 226, 153, 102);

    client = cc3000.connectTCP(stream_ip, 80);
    while ( !client.connected() ) {
        if(log_level < 4){} Serial.println(F("... Couldn\'t connect to servers... trying again!"));
        fibonacci_ += fibonacci_;
        delay(min(fibonacci_, 60000));
        client = cc3000.connectTCP(stream_ip, 80);
    }
    fibonacci_ = 1;
    if(log_level < 3){} Serial.println(F("... Connected to plotly's streaming servers\n... Initializing stream"));

    print_(F("POST / HTTP/1.1\r\n"));
    print_(F("Host: 127.0.0.1\r\n"));
    print_(F("User-Agent: Python\r\n"));
    print_(F("Transfer-Encoding: chunked\r\n"));
    print_(F("Connection: close\r\n"));
    if(convertTimestamp){
        print_(F("plotly-convertTimestamp: \""));
        print_(timezone);
        print_(F("\""));
    } 
    print_(F("\r\n\r\n"));

    if(log_level < 3){} Serial.println(F("... Done initializing, ready to stream!"));
}
开发者ID:fluuuxtechblog,项目名称:arduino-api,代码行数:42,代码来源:plotly_streaming_cc3000.cpp


示例12: fatal

 void fatal(const std::string & msg)
 {
     print_(_fatal, msg);
 }
开发者ID:wehu,项目名称:grcv,代码行数:4,代码来源:grcv_logger.cpp


示例13: if

bool plotly::init(){
    //
    //  Validate a stream with a REST post to plotly
    //
    if(dry_run && log_level < 3){
        Serial.println(F("... This is a dry run, we are not connecting to plotly's servers..."));
    }
    else if(log_level < 3) {
        Serial.println(F("... Attempting to connect to plotly's REST servers"));
    }
    while ( !client.connect("plot.ly", 80) ) {
        if(log_level < 4){
            Serial.println(F("... Couldn\'t connect to plotly's REST servers... trying again!"));
        }
        fibonacci_ += fibonacci_;
        delay(min(fibonacci_, 60000));
    }
    fibonacci_ = 1;
    if(log_level < 3){} Serial.println(F("... Connected to plotly's REST servers"));
    if(log_level < 3){} Serial.println(F("... Sending HTTP Post to plotly"));
    print_(F("POST /clientresp HTTP/1.1\r\n"));
    print_(F("Host: plot.ly\r\n"));
    print_(F("User-Agent: SparkCore/0.0.1\r\n"));
    print_(F("Content-Type: application/x-www-form-urlencoded\r\n"));

    print_(F("Content-Length: "));
    int contentLength = 126 + len_(username_) + len_(fileopt) + nTraces_*(87+len_(maxpoints)) + (nTraces_-1)*2 + len_(filename_);
    if(world_readable){
        contentLength += 4;
    } else{
        contentLength += 5;
    }
    print_(contentLength);
    // contentLength =
    //   44  // first part of querystring below
    // + len_(username)  // upper bound on username length
    // + 5   // &key=
    // + 10  // api_key length
    // + 7  // &args=[...
    // + nTraces*(87+len(maxpoints)) // len({\"y\": [], \"x\": [], \"type\": \"scatter\", \"stream\": {\"token\": \") + 10 + len(\", "maxpoints": )+len(maxpoints)+len(}})
    // + (nTraces-1)*2 // ", " in between trace objects
    // + 22  // ]&kwargs={\"fileopt\": \"
    // + len_(fileopt)
    // + 16  // \", \"filename\": \"
    // + len_(filename)
    // + 21 // ", "world_readable":
    // + 4 if world_readable, 5 otherwise
    // + 1   // closing }
    //------
    // 126 + len_(username) + len_(fileopt) + nTraces*(86+len(maxpoints)) + (nTraces-1)*2 + len_(filename)
    //
    // Terminate headers with new lines
    print_(F("\r\n\r\n"));

    // Start printing querystring body
    print_(F("version=2.3&origin=plot&platform=arduino&un="));
    print_(username_);
    print_(F("&key="));
    print_(api_key_);
    print_(F("&args=["));
    // print a trace for each token supplied
    for(int i=0; i<nTraces_; i++){
        print_(F("{\"y\": [], \"x\": [], \"type\": \"scatter\", \"stream\": {\"token\": \""));
        print_(stream_tokens_[i]);
        print_(F("\", \"maxpoints\": "));
        print_(maxpoints);
        print_(F("}}"));
        if(nTraces_ > 1 && i != nTraces_-1){
            print_(F(", "));
        }
    }
    print_(F("]&kwargs={\"fileopt\": \""));
    print_(fileopt);
    print_(F("\", \"filename\": \""));
    print_(filename_);
    print_(F("\", \"world_readable\": "));
    if(world_readable){
        print_("true");
    } else{
        print_("false");
    }
    print_(F("}"));
    // final newline to terminate the POST
    print_(F("\r\n"));

    //
    // Wait for a response
    // Parse the response for the "All Streams Go!" and proceed to streaming
    // if we find it
    //
    char allStreamsGo[] = "All Streams Go!";
    int asgCnt = 0; // asg stands for All Streams Go
    char url[] = "\"url\": \"http://plot.ly/~";
    char fid[4];
    int fidCnt = 0;
    int urlCnt = 0;
    int usernameCnt = 0;
    bool proceed = false;
    bool fidMatched = false;

//.........这里部分代码省略.........
开发者ID:Joel-Therrien,项目名称:UML-Engineering-Camp,代码行数:101,代码来源:spark-plotly.cpp


示例14: set

void plotly::open_stream(int N, int M, char *filename_, char *layout){
    N_ = N;  // total sets of data sent = number of rows in plotly-json data matrix
    M_ = (M*2); // total number of traces * 2 = number of columns in plotly-json data matrix
    ni_ = 0; // counter of number of sets of data set (number of rows in the plotly-json data matrix) transmitted
    mi_ = 0; // counter of points sent in each row of data
    nChar_ = 0; // counter of number of characters transmitted
    filename=filename_;
    delay(1000);
    if(DRY_RUN){ Serial.println("This is a dry run, we are not connecting to plotly's servers..."); }
    else{
      if(VERBOSE) { Serial.println("Attempting to connect to plotly's servers..."); }
      char server[] = "plot.ly";
      while ( !client.connect(server, 443) ) {
        if(VERBOSE){ Serial.println("Couldn\'t connect to servers.... trying again!"); }
        delay(1000);
      }
    }
    if(VERBOSE) Serial.println("Connected to plotly's servers");
    if(VERBOSE) Serial.println("\n== Sending HTTP Post to plotly ==");

    // HTTP Meta
    println_("POST /clientresp HTTP/1.1", 0);
    println_("Host: 107.21.214.199", 0);
    println_("User-Agent: Arduino/2.0", 0);

    // compute an upper bound on the post body size
    upper_ = 273+strlen(layout)+((N_*M_-1)*2)+((N_-1)*4)+(max(20,maxStringLength)*N_*M_);
      /* Computation composition: 
        44 // First part of querystring below
        + 30 // Upper limit on username length
        + 5  // "&key="
        + 10 // api key length
        + 6  // "&args="
        + 22 // "&kwargs={\"filename\": \""
        + 100 // upper bound on filename
        + 53 // "\", \"fileopt\": \"extend\", \"transpose\": true, \"layout\": "
        + layout.length()
        + 1 // closing }
        + (N_*M_-1)*2   // + 2-chars for comma and space for all but the last numbers ... 
        + (N_-1)*4  // + 4-chars for square brackets, comma, space for n-1 set of points [], 
        + 2         // + 2-chars for start 'n finish square braces
        + max(20,maxStringLength)*N_*M_;  // + max character buffer in converting floats to strings. NOTE: The largest float is 56 chars... should the buffer be this big? [(48-chars for largest float integer left of the decimal (-3.4028235E+38) )+(1 decimal pt)+(6 digits of precision right of the decimal)=56-chars]*each float
     */   

    if(timestamp){
      upper_ += 122;
      /* Computation composition: 
      upper_ += 26 // \"convertTimestamp\": true"
        + 41 // ", \"convertTimestamp\": true, \"timezone\": \""
        + 30 // upper bound on timezones string
        + 15 // "\", \"sentTime\": "
        + 10; // max length of unsigned long for sentTime: 4,294,967,295
      */
    }

    // send the header to plotly
    print_("Content-Length: ", 0);
    println_(upper_, 0);
    println_("", 0);

    // start the post string
    print_("version=0.2&origin=plot&platform=arduino&un=", 44);
    print_(username);
    print_("&key=", 5);
    print_(api_key);
    print_("&args=", 6);
}
开发者ID:ecoaspect,项目名称:arduino-api,代码行数:67,代码来源:plotly_wifi.cpp


示例15: sqrt


//.........这里部分代码省略.........

  global_1.ldt = h__;
  /* .....THE FIRST SET OF SEARCH DIRECTIONS V IS THE IDENTITY MATRIX.....
  */
  i__1 = *n;

  for (i__ = 1; i__ <= i__1; ++i__)
    {
      i__2 = *n;

      for (j = 1; j <= i__2; ++j)
        {
          /* L10: */
          q_1.v[i__ + j * 100 - 101] = 0.;
        }

      /* L20: */
      q_1.v[i__ + i__ * 100 - 101] = 1.;
    }

  d__[0] = 0.;
  q_1.qd0 = 0.;
  i__1 = *n;

  for (i__ = 1; i__ <= i__1; ++i__)
    {
      q_1.q0[i__ - 1] = x[i__];
      /* L30: */
      q_1.q1[i__ - 1] = x[i__];
    }

  if (*prin > 0)
    {
      print_(n, &x[1], prin, fmin);
    }

  /* .....THE MAIN LOOP STARTS HERE..... */
L40:
  sf = d__[0];
  d__[0] = 0.;
  s = 0.;

  /* .....MINIMIZE ALONG THE FIRST DIRECTION V(*,1). */
  /*     FX MUST BE PASSED TO MIN BY VALUE. */
  value = global_1.fx;
  min_(n, &c__1, &c__2, d__, &s, &value, &c_false, f, &x[1], &t,
       machep, &h__);

  if (s > 0.)
    {
      goto L50;
    }

  i__1 = *n;

  for (i__ = 1; i__ <= i__1; ++i__)
    {
      /* L45: */
      q_1.v[i__ - 1] = -q_1.v[i__ - 1];
    }

L50:

  if (sf > d__[0] * .9 && sf * .9 < d__[0])
    {
      goto L70;
开发者ID:ShuoLearner,项目名称:COPASI,代码行数:67,代码来源:CPraxis.cpp


示例16: cc3000


//.........这里部分代码省略.........
    ni_ = 0; // counter of number of sets of data set (number of rows in the plotly-json data matrix) transmitted
    mi_ = 0; // counter of points sent in each row of data
    nChar_ = 0; // counter of number of characters transmitted
    filename=filename_;
    delay(1000);
    if(DRY_RUN){ Serial.println("This is a dry run, we are not connecting to plotly's servers..."); }
    else{
      if(VERBOSE) { Serial.println("Attempting to connect to plotly's servers..."); }

      #ifdef WIFI
      char server[] = "plot.ly";
      while ( !client.connect(server, 80) ) {
        if(VERBOSE){ Serial.println("Couldn\'t connect to servers.... trying again!"); }
        delay(1000);
      }
      #endif
      #ifdef ETHERNET
      char server[] = "plot.ly";
      while ( !client.connect(server, 80) ) {
        if(VERBOSE){ Serial.println("Couldn\'t connect to servers.... trying again!"); }
        delay(1000);
      }
      #endif
      #ifdef GSM
      char server[] = "plot.ly";
      while ( !client.connect(server, 80) ) {
        if(VERBOSE){ Serial.println("Couldn\'t connect to servers.... trying again!"); }
        delay(1000);
      }
      #endif
      #ifdef CC3000
      #define WEBSITE "plot.ly"
      uint32_t ip = 0;
      
      // Try looking up the website's IP address
      Serial.print(WEBSITE); Serial.print(F(" -> "));
      while (ip == 0) {
      if (! cc3000.getHostByName(WEBSITE, &ip)) {
        Serial.println(F("Couldn't resolve!"));
      }
      delay(500);
      }

      client = cc3000.connectTCP(ip, 80);
      while ( !client.connected() ) {
        if(VERBOSE){ Serial.println("Couldn\'t connect to servers.... trying again!"); }
        delay(1000);
      }
      #endif
    }
    if(VERBOSE) Serial.println("Connected to plotly's servers");
    if(VERBOSE) Serial.println("\n== Sending HTTP Post to plotly ==");

    // HTTP Meta
    println_("POST /clientresp HTTP/1.1", 0);
    println_("Host: 107.21.214.199", 0);
    println_("User-Agent: Arduino/2.0", 0);

    // compute an upper bound on the post body size
    upper_ = 273+strlen(layout)+((N_*M_-1)*2)+((N_-1)*4)+(max(20,maxStringLength)*N_*M_);
      /* Computation composition: 
        44 // First part of querystring below
        + 30 // Upper limit on username length
        + 5  // "&key="
        + 10 // api key length
        + 6  // "&args="
        + 22 // "&kwargs={\"filename\": \""
        + 100 // upper bound on filename
        + 53 // "\", \"fileopt\": \"extend\", \"transpose\": true, \"layout\": "
        + layout.length()
        + 1 // closing }
        + (N_*M_-1)*2   // + 2-chars for comma and space for all but the last numbers ... 
        + (N_-1)*4  // + 4-chars for square brackets, comma, space for n-1 set of points [], 
        + 2         // + 2-chars for start 'n finish square braces
        + max(20,maxStringLength)*N_*M_;  // + max character buffer in converting floats to strings. NOTE: The largest float is 56 chars... should the buffer be this big? [(48-chars for largest float integer left of the decimal (-3.4028235E+38) )+(1 decimal pt)+(6 digits of precision right of the decimal)=56-chars]*each float
     */   

    if(timestamp){
      upper_ += 122;
      /* Computation composition: 
      upper_ += 26 // \"convertTimestamp\": true"
        + 41 // ", \"convertTimestamp\": true, \"timezone\": \""
        + 30 // upper bound on timezones string
        + 15 // "\", \"sentTime\": "
        + 10; // max length of unsigned long for sentTime: 4,294,967,295
      */
    }

    // send the header to plotly
    print_("Content-Length: ", 0);
    println_(upper_, 0);
    println_("", 0);

    // start the post string
    print_("version=0.2&origin=plot&platform=arduino&un=", 44);
    print_(username);
    print_("&key=", 5);
    print_(api_key);
    print_("&args=", 6);
}
开发者ID:ecoaspect,项目名称:arduino-api,代码行数:101,代码来源:plotly.pre.cpp


示例17: print_

std::string FastRational::get_str() const
{
  std::ostringstream os;
  print_(os);
  return os.str();
}
开发者ID:4lex4nder,项目名称:dreal3,代码行数:6,代码来源:FastRationals.C


示例18: error

 void error(const std::string & msg)
 {
     print_(_error, msg);
 }
开发者ID:wehu,项目名称:grcv,代码行数:4,代码来源:grcv_logger.cpp


示例19: print

void print(Node *root, const std::string &msg) {
  std::cout << msg << ": ";
  print_(root);
  std::cout << "\n";
}
开发者ID:elinus,项目名称:CODE,代码行数:5,代码来源:Problem-13.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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