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


C++ print_result函数代码示例

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


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

示例1: launch_easy_calc

void	launch_easy_calc(int *num, char *op)
{
  int	i;
  int	x;

  i = 0;
  x = 1;
  while (op[i] != '\0')
    {
      if (op[i] == '+' || op[i] == '-')
	{
	  while (op[i] == '+' || op[i] == '-')
	    {
	      num[x] = easy_calc(num, op, i, x);
	      i++;
	    }
	}
      i++;
    }
  print_result(num[1]);
}
开发者ID:heitzls,项目名称:Calculator,代码行数:21,代码来源:calculator.c

示例2: write_ndef_to_tag

void write_ndef_to_tag(nfc_error_e error, void *user_data){

	nfc_tag_h  tag;
	int ret ;

	printf("write_ndef_to_tag\n");
	ret = nfc_manager_get_connected_tag(&tag);
	printf("nfc_manager_get_connected_tag ret(0x%08x)  !\n",ret);


	if ( ret == NFC_ERROR_NONE)
	{
		printf("tag alread attached !\n");
		//write NDEF Message
		nfc_ndef_record_h record;
		nfc_ndef_message_h message;
		nfc_ndef_record_create_uri(&record, "http://samsung.com");
		nfc_ndef_message_create(&message);
		nfc_ndef_message_append_record(message, record);
		printf("Write request!\n");
		timeout_counter = 30;
		nfc_tag_write_ndef(tag, message , _write_completed_cb , NULL);
		nfc_ndef_message_destroy(message);
	}
	else
	{

	int ret;

	success = 0;
	timeout_counter = 30;

	ret = nfc_manager_set_tag_discovered_cb( _tag_discovered_cb , NULL);
	print_result("nfc_manager_set_tag_discovered_cb", ret);

	printf("Now, Bring the tag closer. Will be writen a new NDEF Message\n");
	ecore_timer_add(1, timeout_handler, NULL);

	}
}
开发者ID:tizenorg,项目名称:framework.api.nfc,代码行数:40,代码来源:network_nfc_test.c

示例3: query_file_by_curr_location

/**
 * 根据位置查询文件信息
 */
int
query_file_by_curr_location(char* diskName,char* dirId,char *start_ra, char *end_ra, char *start_dec, char *end_dec){

	char sql[MAX_BUF_SIZE];
	memset(sql, 0, sizeof(sql));
	sprintf(sql, "SELECT * FROM `file_info` Where ra_val >= '%s' AND ra_val <= '%s' AND dec_val >= '%s' AND dec_val <= '%s' AND disk_name = '%s' AND directory_id = '%s'",
			start_ra, end_ra, start_dec, end_dec,diskName,dirId);

	if (mysql_query(g_conn, sql)){
		 print_mysql_error(NULL);
	}

	g_res = mysql_store_result(g_conn); // 从服务器传送结果集至本地,mysql_use_result直接使用服务器上的记录集
    print_result();
    free_result();

    memset(sql,0,sizeof(sql));
    sprintf(sql,"SELECT directory_id FROM 'directory_info' WHERE disk_name = '%s' AND parent_id = '%s'",diskName,dirId);

    if(mysql_query(g_conn,sql)){
    	print_mysql_error(NULL);
    }

    g_res = mysql_store_result(g_conn);

    int i;
    char* childId = (char*)malloc(MAX_BUF_SIZE);

    while((g_row = mysql_fetch_row(g_res)))
    {
    	for(i = 0; i < get_fields(g_res); i++)
    	{
    		memset(childId,0,sizeof(childId));
    		sprintf(childId,"%s",g_row[i]);
    		query_file_by_curr_location(diskName,childId,start_ra,end_ra,start_dec,end_dec);
    	}
    }

	return EXIT_SUCCESS;
}
开发者ID:yuanzichao,项目名称:ast3_storage_client,代码行数:43,代码来源:sql.c

示例4: gbt_print_error

double gbt_print_error(CvGBTrees*gbt, const CvMat*values, const CvMat*response, int response_idx, const CvMat*train_sidx)
{
    int count = 0;
    float*tmp = new float[values->cols];
    int t;
    int total = 0;
    int train_total = 0;
    double error = 0;
    double train_error = 0;
    for(t=0;t<values->rows;t++) {
        int s;
        int c=0;
        for(s=0;s<values->cols;s++) {
            tmp[c++] = CV_MAT_ELEM((*values), float, t, s);
        }
        CvMat m = cvMat(1, c, CV_32FC1, tmp);

        float r1 = gbt->predict(&m, 0);
        float r2 = CV_MAT_ELEM((*response), float, t, 0);

        bool train = 0;
        for(s=0;s<train_sidx->cols;s++) {
            if(CV_MAT_ELEM((*train_sidx), unsigned, 0, s) == t) {
                train = 1;
                break;
            }
        }

        if(train) {
            train_total++;
            if(r1!=r2)
                train_error++;
        } else {
            total++;
            if(r1!=r2)
                error++;
        }
    }
    print_result(train_error * 100 / train_total, error * 100 / total, 0);
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:40,代码来源:test_cv.cpp

示例5: test_sort

int test_sort()
{
    int failures = 0;
    const int test_count = 4;
    printf("\n*** Testing buildin sort ***\n");
    cstring *Vojto = cstr_create_str("abcABCdefDEF");

    cstring *Albert = Vojto;
    sort(&Albert);

    if (strcmp(Albert->str, "ABCDEFabcdef") != 0) {
        print_cstr_all(Vojto);
        failures++;
    }

    cstr_clear(Vojto);
    cstr_append_str(Vojto, "123987");
    cstring *Pavel = Vojto;
    sort(&Pavel);

    if ((strcmp(Pavel->str, "123789") != 0)) {
        print_cstr_all(Vojto);
        failures++;
    }

    cstr_clear(Vojto);
    cstr_append_str(Vojto, "1234abCDefGH");
    cstring *Adam = Vojto;
    sort(&Adam);

    if ((strcmp(Adam->str, "1234CDGHabef") != 0)) {
        print_cstr_all(Vojto);
        failures++;
    }

    print_result(test_count, failures);


    return failures;
}
开发者ID:Shootervm,项目名称:IFJ-14,代码行数:40,代码来源:tests_buildin.c

示例6: test_sha512

static void test_sha512(void)
{
  size_t i;

  printf("test SHA512\n");

  for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
    SHA512_CTX ctx;
    unsigned char r[64];
    const char *s = test_vectors[i];

    SHA512_Init(&ctx);
    SHA512_Update(&ctx, s, strlen(s));
    SHA512_Final(r, &ctx);

    print_result(&r[0], sizeof(r));

    rtems_test_assert(
      memcmp(&r[0], &test_sha512_results[i][0], sizeof(r)) == 0
    );
  }
}
开发者ID:Avanznow,项目名称:rtems,代码行数:22,代码来源:init.c

示例7: main

/*
 *   Main
 * ---------------------------------------------------------------------
 *  - just a wrapper over the inpotrant functions, as ussual
 */
int main (int argc, char * argv[])
{
  struct keep_data data;
  if (parse_arguments(argc, argv, &data) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  int sock;
  if (establish_connection(&data, &sock) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  if (send_data(&data.msg, &sock) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  char * buffer = NULL;
  if (get_respose(&sock, &buffer) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  print_result(buffer);

  close(sock);
  return EXIT_SUCCESS;
}
开发者ID:jirenne,项目名称:FIT-VUT-projects,代码行数:27,代码来源:client.c

示例8: main

int main()
{
	short n1_sign, n2_sign, ans_sign;
	short n1[LEN] = {0}, n2[LEN] = {0}, ans[LEN] = {0};
	int n1_length, n2_length;
	char n1_in[LEN], n2_in[LEN];
    
	while ( ~scanf("%s%s", n1_in, n2_in) )
	{
		n1_length = strlen(n1_in);
		n2_length = strlen(n2_in);
		n1_sign = sign(n1_in[0]);
		n2_sign = sign(n2_in[0]);
		get_num(n1_in, n1, n1_sign, &n1_length);
		get_num(n2_in, n2, n2_sign, &n2_length);
		compare_and_compute(n1, n1_sign, n1_length, n2, n2_sign, n2_length, ans, &ans_sign);
		print_result(ans, ans_sign);
        
		clear(n1,n2,ans);
	}
	return 0;
}
开发者ID:hydai,项目名称:NTHU-OJ-Code,代码行数:22,代码来源:9001_add_big_number.c

示例9: main

int main(int argc, char *argv[])
{
        int fd_in, fd_out;
        struct timeval t0, t1;

        setup(&fd_in, &fd_out, NULL);

        CHECK_ERROR(-1, gettimeofday(&t0, NULL));

        for (int i = 0; i < BENCHNUM; i++) {
                run_sendfile(fd_in, fd_out);
        }

        CHECK_ERROR(-1, gettimeofday(&t1, NULL));

        int diff = get_diff(&t0, &t1);

        printf("====== BENCH SENDFILE ======\n");
        print_result(diff);

        return 0;
}
开发者ID:yifan-gu,项目名称:bench_splice,代码行数:22,代码来源:benchsendfile.c

示例10: main

int main (int argc, char ** argv)
{
	printf ("FCRYPT       TESTS\n");
	printf ("==================\n\n");

	init (argc, argv);

	if (!gpg_available (newPluginConfiguration ()))
	{
		printf ("The test was disabled because gpg could not be found on the system.\n");
		return nbError;
	}

	test_gpg ();
	test_init ();
	test_file_crypto_operations ();
	test_file_signature_operations ();
	test_file_faulty_signature ();

	print_result (ELEKTRA_PLUGIN_NAME);
	return nbError;
}
开发者ID:waht,项目名称:libelektra,代码行数:22,代码来源:testmod_fcrypt.c

示例11: test_length

int test_length()
{
    int failures = 0;
    const int test_count = 4;

    cstring *Vojto = cstr_create_str("Ahoj Karle");
   printf("\n*** Testing buildin length ***\n");

    if (length(Vojto) != 10) {
        print_cstr_all(Vojto);
        failures++;
    }

    cstr_append_str(Vojto, "1234");

    if (length(Vojto) != 14) {
        print_cstr_all(Vojto);
        failures++;
    }

    cstr_assign_str(Vojto, "Your penis smells like shit.");


    if (length(Vojto) != 28) {
        print_cstr_all(Vojto);
        failures++;
    }

    cstr_assign_str(Vojto, "");

    if (length(Vojto) != 0) {
        print_cstr_all(Vojto);
        failures++;
    }

    print_result(test_count, failures);

    return failures;
}
开发者ID:Shootervm,项目名称:IFJ-14,代码行数:39,代码来源:tests_buildin.c

示例12: com_sub

int com_sub(char* arg)
{
    if (!arg)
        arg = "";
    int operands[2];

    char *operand;
    operand = strtok(arg, " ");

    if (operand) {
        operands[0] = atoi(operand);
    }

    operand = strtok(NULL, " ");

    if (operand) {
        operands[1] = atoi(operand);
    }

    print_result('-', itoa(operands[0], operand1, base), itoa(operands[1], operand2, base), itoa((operands[0] - operands[1]), answer, base));
    return 1;
}
开发者ID:rcousens,项目名称:bcalc,代码行数:22,代码来源:command.c

示例13: test_sort_insertion

int test_sort_insertion() // 插入排序
{
	// reference: http://cforbeginners.com/insertionsort.html
	std::vector<int> vec(array_src.begin(), array_src.end());
	int tmp = 0, j = 0;

	for (int i = 1; i < vec.size(); i++){
		j = i;

		while (j > 0 && vec[j] < vec[j - 1]){
			tmp = vec[j];
			vec[j] = vec[j - 1];
			vec[j - 1] = tmp;
			j--;
		}
	}

	fprintf(stderr, "insertion sort result: \n");
	print_result(vec);

	return 0;
}
开发者ID:fengbingchun,项目名称:Messy_Test,代码行数:22,代码来源:sort.cpp

示例14: main

int main(int argc, char**argv) {

  parse_args(argc, argv);
  
  if(streaming_mode) {
    streaming_sort();
    return 0;
  }

  int *data;
  int nitems = read_file(infile_name, &data);
  
  if(nthreads == -1)
    baseline_nonthreaded_mergesort(data,nitems); 
  else
    my_threaded_mergesort(data,nitems);
    
  print_result(outfile_name, data, nitems);

  return 0;

}
开发者ID:Yankkk,项目名称:C,代码行数:22,代码来源:main.c

示例15: main

int main(void)
{
	int i, j, k;

	scanf("%d %d", &m, &c);

	for(i=1; i<=m; i++)	{
		scanf("%d", &garb);
		for(j=1; j<=c; j++)	{
			scanf("%d", &in[i][j]);
		}
	}

	for(i=0; i<=c; i++)
		dynamic[0][i] = 0;
	for(i=0; i<=m; i++)
		dynamic[i][0] = 0;

	for(i=1; i<=c; i++)	//i는 현재 기업 번호
	{
		for(j=1; j<=m; j++)	//j는 현재 기업에 투자한 금액
		{
			for(k=0; k<=j; k++)	
			{
				if(dynamic[j][i] < dynamic[k][i-1] + in[j-k][i])	{
					dynamic[j][i] = dynamic[k][i-1] + in[j-k][i];
					invest[j][i] = j-k;
				}	//if
			}	//for k
		}	//for j
	}	//for i

	printf("%d\n", dynamic[m][c]);

	print_result(m, c);


	return 0;
}
开发者ID:HANJEONGWOO,项目名称:JUNGOL,代码行数:39,代码来源:1825.cpp


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