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

C++ print_results函数代码示例

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

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



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

示例1: main

int main(int argc, char** argv) {
	guint8 * key, * msg, * plain;
	gsize key_len, msg_len;

	key = g_malloc0(KEY_SIZE);
	msg = g_malloc0(MSG_SIZE);
	plain = g_malloc0(MSG_SIZE);

	if ((key_len = get_input(key, KEY_SIZE, "Enter QQ key: ")) == -1) {
		return EXIT_FAILURE;
	}

	if ((msg_len = get_input(msg, MSG_SIZE, "Enter QQ msg: ")) == -1) {
		return EXIT_FAILURE;
	}

	qq_decrypt(plain, msg, msg_len, key);
	g_printf("Encrypted msg: ");
	print_results(msg, msg_len);

	g_printf("Key: ");
	print_results(key, key_len);

	g_printf("Decrypted msg: ");
	print_results(plain, msg_len);

	g_free(key);
	g_free(msg);
	g_free(plain);

	return EXIT_SUCCESS;
}
开发者ID:1dot75cm,项目名称:pidgin-libqq,代码行数:32,代码来源:decrypt.c


示例2: main

int main()
{
    int m, i, n;
    double x[MAX_m], w[MAX_m], c[MAX_n+1], eps;

    m = 90;
    for (i=0; i<m; i++) {
        x[i] = 3.1415926535897932 * (double)(i+1) / 180.0;
        w[i] = 1.0;
    }
    eps = 0.001;
    n = OPA(f1, m, x, w, c, &eps);
    print_results(n, c, eps);

    m = 200;
    for (i=0; i<m; i++) {
        x[i] = 0.01*(double)i;
        w[i] = 1.0;
    }
    eps = 0.001;
    n = OPA(f2, m, x, w, c, &eps);
    print_results(n, c, eps);

    return 0;
}
开发者ID:Icay12,项目名称:Junior-Courses,代码行数:25,代码来源:4-7.c


示例3: main

int main(int argc, char* argv[])
{
  bool test_kinematics = false;
  for(int i=1; i<argc; ++i)
  {
    if(std::string(argv[i])=="-k")
      test_kinematics = true;
  }

  std::vector<dart::simulation::WorldPtr> worlds = getWorlds();

  if(test_kinematics)
  {
    std::cout << "Testing Kinematics" << std::endl;
    std::vector<double> acceleration_results;
    std::vector<double> velocity_results;
    std::vector<double> position_results;

    for(size_t i=0; i<10; ++i)
    {
      std::cout << "\nTrial #" << i+1 << std::endl;
      runKinematicsTest(acceleration_results, worlds, true, true, true);
      runKinematicsTest(velocity_results, worlds, true, true, false);
      runKinematicsTest(position_results, worlds, true, false, false);
    }

    std::cout << "\n\n --- Final Kinematics Results --- \n\n";

    std::cout << "Position, Velocity, Acceleration\n";
    print_results(acceleration_results);

    std::cout << "\nPosition, Velocity\n";
    print_results(velocity_results);

    std::cout << "\nPosition\n";
    print_results(position_results);

    return 0;
  }

  std::cout << "Testing Dynamics" << std::endl;
  std::vector<double> dynamics_results;
  for(size_t i=0; i<10; ++i)
  {
    std::cout << "\nTrial #" << i+1 << std::endl;
    runDynamicsTest(dynamics_results, worlds);
  }

  std::cout << "\n\n --- Final Dynamics Results --- \n\n";
  print_results(dynamics_results);
}
开发者ID:dtbinh,项目名称:dart,代码行数:51,代码来源:Main.cpp


示例4: main

int main (int argc, char *argv[]) 
{
int i, nthreads, tid, section;
float a[N], b[N], c[N];
void print_results(float array[N], int tid, int section);

/* Some initializations */
for (i=0; i<N; i++)
  a[i] = b[i] = i * 1.0;

#pragma omp parallel private(c,i,tid,section)
  {
  tid = omp_get_thread_num();
  if (tid == 0)
    {
    nthreads = omp_get_num_threads();
    printf("Number of threads = %d\n", nthreads);
    }

  /*** Use barriers for clean output ***/
  #pragma omp barrier
  printf("Thread %d starting...\n",tid);
  #pragma omp barrier

  #pragma omp sections nowait
    {
    #pragma omp section
      {
      section = 1;
      for (i=0; i<N; i++)
        c[i] = a[i] * b[i];
      print_results(c, tid, section);
      }

    #pragma omp section
      {
      section = 2;
      for (i=0; i<N; i++)
        c[i] = a[i] + b[i];
      print_results(c, tid, section);
      }

    }  /* end of sections */

  /*** Use barrier for clean output ***/
  #pragma omp barrier
  printf("Thread %d exiting...\n",tid);

  }  /* end of parallel section */
}
开发者ID:jywannie1,项目名称:HPC,代码行数:50,代码来源:omp_solved3.c


示例5: memcpy_with_stride

long int memcpy_with_stride(int fd, int stride, int filesize)
{
	struct timeval start, end;
	int counter, ops, bytes;
	char *mapped;
	char *buffer = malloc(sizeof(char)*filesize);
	mapped = mmap(0, filesize, PROT_READ, MAP_SHARED, fd, 0);
	bytes = 0;
	ops = 0;
	gettimeofday(&start, NULL);
	for(counter = 0; counter + stride < filesize; counter += stride)
	{
		ops++;
		bytes += stride;
		memcpy(buffer+counter, mapped, stride);
	}
	if(counter < filesize)
	{
		ops++;
		bytes += filesize - counter;
		memcpy(buffer + counter, mapped, filesize - counter);
	}
	gettimeofday(&end, NULL);
	print_results(get_log_10(stride), ops, bytes, get_time_diff(start, end));
	free(buffer);
	return get_time_diff(start, end);
}
开发者ID:dloch,项目名称:school-projects-undergrad,代码行数:27,代码来源:io_bench.c


示例6: digest_file

void media_identifier::identify_file(const char *name)
{
	std::vector<file_info> info;
	digest_file(info, name);
	match_hashes(info);
	print_results(info);
}
开发者ID:qwijibo,项目名称:mame,代码行数:7,代码来源:media_ident.cpp


示例7: collect_files

void media_identifier::identify(const char *filename)
{
	std::vector<file_info> info;
	collect_files(info, filename);
	match_hashes(info);
	print_results(info);
}
开发者ID:qwijibo,项目名称:mame,代码行数:7,代码来源:media_ident.cpp


示例8: main

int main(int argc, char** argv) {
    /* error_num takes the value of any error_descriptors returned from the 
     * file handling functions */
    int error_num = INITIAL_ERROR_NUM_VALUE;
    FILE * fp;
    
    /* the competitor at the root, and the information for the competition*/
    competitor * root;
    competition competition;
    
    /* pass fp by reference in order to modify its values
     * within the get_file_name_and_open function
     * call check_error to check if an error occurred, and if so react
     * appropriately */
    error_num = get_file_name_and_open(&fp);
    if(check_error(error_num)) return EXIT_FAILURE;
    
    /* pass a pointer to the root pointer, the file pointer and a pointer
     * to the competition, to read all the data for each competitor and the
     * competition itself, from the file. Adding each competitor to the 
     * binary tree as we go.
     * as before, call check_error to detect error occurrence */
    error_num = read_file(&competition, &root, fp);
    if(check_error(error_num)) return EXIT_FAILURE;
    fclose(fp);
     
    /*  calls the in_order_traverse function and passes the corresponding
     *  pointer to printing function: print_results_inner for each node*/
    print_results(competition, root);
    return (EXIT_SUCCESS);
}
开发者ID:jamesu2h,项目名称:Portfolio,代码行数:31,代码来源:main.c


示例9: main

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

/*
    Default values
*/
    gchar *output_result_file ="shot.txt";
    gchar *str_pipeline = NULL;

    /* Get input arguments */
    if (get_input_arguments (argc, argv, &option, &output_result_file, &str_pipeline) == FALSE)
    {
        return -1;
    }

    {/* Play the pipeline */
        g_assert( run_pipeline(argc,argv,str_pipeline) == 0);
    }

    {/* print the results */
        print_results (option, output_result_file);
    }

    { /* Cleaning global variables */
        g_hash_table_destroy (timestamps);
    }


    return 0;
}
开发者ID:mrchapp,项目名称:gstcamera-measure,代码行数:32,代码来源:shot.c


示例10: main

int main(int argc, char **argv){
	to_visit = create_stack();
	visited = create_empty_list();
	
	char *path = NULL;
	if(argc > 2){
		usage();
		exit(-1);
	}
	//start search at specified directory
	if(argc == 2){
		path = *(argv+1);
	}
	//start search at current working directory (default behavior)
	else{
		path = ".";
	}
	push_key(to_visit, path);
	
	char *cur;
	while(!is_stack_empty(to_visit)){
		cur = (char *)(pop(to_visit)->data);
		if(process(cur) == -1){
			break;
		}
	}
	
	print_results();
	
	
	return 0;
}
开发者ID:hegek87,项目名称:os,代码行数:32,代码来源:file_comp.c


示例11: run

static void run(struct options options, size_t *offset, size_t *size_max, double *single_red_cum, double *intra_red_cum,
    double *inter_red_cum, size_t index, char print) {
  if(options.latex) {
    struct context inter;
    memset(&inter, 0, sizeof(inter));
    struct context intra;
    memset(&intra, 0, sizeof(intra));
    struct context single;
    memset(&single, 0, sizeof(single));

    file_bounds_set(options, offset, size_max, options.files[index]);

    //fprintf(stderr, "Size: %zu\n", *size_max);

    analyze(options.files[index], print, MODE_SINGLE, options.fsubst, options.chain, options.cleanup, *offset,
        *size_max, options.offset, &single);
    analyze(options.files[index], print, MODE_DEFAULT, options.fsubst, options.chain, options.cleanup, *offset,
        *size_max, options.offset, &intra);
    analyze(options.files[index], print, MODE_CHILDREN, options.fsubst, options.chain, options.cleanup, *offset, *size_max, options.offset, &inter);

    print_results_latex(options.files[index], &single, &intra, &inter);

    *single_red_cum += 1 - (single.stmts_opt / (double)single.stmts);
    *intra_red_cum += 1 - (intra.stmts_opt / (double)intra.stmts);
    *inter_red_cum += 1 - (inter.stmts_opt / (double)inter.stmts);
  } else {

    struct context context;
    memset(&context, 0, sizeof(context));
    file_bounds_set(options, offset, size_max, options.files[index]);
    analyze(options.files[index], print, options.mode, options.fsubst, options.chain, options.cleanup, *offset, *size_max, options.offset, &context);

    print_results(&context);
  }
}
开发者ID:chubbymaggie,项目名称:gdsl-toolkit,代码行数:35,代码来源:optimization-sweep.c


示例12: main

int
main(int argc, char **argv)
{
    char infile[MAX_FILENAME];
    struct tailq        queue;
    struct tailq_node   *node;
    
    if (argc == 1) {
        file_add(&queue, "index.html");
    } else if (argc == 2) {
        strncpy(infile, argv[1], MAX_FILENAME-1);
        extract_files(&queue, infile);
    } else {
        printf("usage: ./cr [in file]\n");
        exit(-1);
    }
    
    node = queue.head;
    for (int i = 0; node; i++) {
        if (!populate_ref(&queue, node))
            tailq_remove(&queue, node);
        node = node->next;
    }
    print_results(&queue);
    
    getchar();
    printf("Bye!\n");
    
    return 0;
}
开发者ID:node-,项目名称:cs8.cross-referencer,代码行数:30,代码来源:main.c


示例13: main_

int main_(int argc, char *argv[])
{
	int cache_params[CACHE_COUNT * 3];
	parse_args(argc, argv, cache_params);

	struct cache caches[CACHE_COUNT];
	int j = 0;
	for (int i = 0; i < CACHE_COUNT; ++i) {
		int level = i + 1;
		int c = cache_params[j++];
		int b = cache_params[j++];
		int s = cache_params[j++];
		cache_init(&caches[i], &caches[i+1], level, c, b, s);
	}
	caches[CACHE_COUNT - 1].next = NULL;

	void *addr;
	char rw;
	while (!feof(stdin)) {
		fscanf(stdin, "%c %p\n", &rw, &addr);
		cache_access(caches, rw2access_type(rw), addr);
	}
	print_results(caches);

	for (int i = 0; i < CACHE_COUNT; ++i) {
		cache_destroy(&caches[i]);
	}
	return 0;
}
开发者ID:samuelbritt,项目名称:CS6290-prj1,代码行数:29,代码来源:cache_sim.c


示例14: main

int main(void) {
   //deklaracja zmiennych, tablice sa globalne
   char pesel[12], name[30];
   int date[3], error, sex;

   error = 0;
   sex = 0;

   // wczytanie danych
   printf("Podaj swoje imie: \n");
   scanf("%s", name);
   printf("Czesc %s, wpisz swoj PESEL. \n", name);
   scanf("%s", pesel);

   error = make_pesel(pesel); //kazda funkcja zwraca albo 0 albo 1
   if(error == 0) {
      error = check(pesel);
      if(error == 0) {
         error = make_and_check_date(pesel, date);
         if(error == 0) {
            error = check_sex(pesel, name, &sex);
            if(error == 0)
               print_results(date, pesel, name, &sex);
            else
               printf("Twoja plec nie zgadza sie z imieniem!");
         } else
            printf("Bledna data urodzenia");
      } else
         printf("Blad liczby kontrolnej!");
   } else
      printf("Bledny numer PESEL!");

   return 0; //no
}
开发者ID:wukat,项目名称:JIMP-IS-2012,代码行数:34,代码来源:pesel.c


示例15: fread_with_stride

long int fread_with_stride(FILE *fd, int stride, int filesize)
{
	struct timeval start, end;
	int counter, ops, bytes;
	char *buffer = malloc(sizeof(char)*filesize);
	bytes = 0;
	ops = 0;
	gettimeofday(&start, NULL);
	for(counter = 0; counter + stride < filesize; counter += stride)
	{
		ops++;
		bytes += stride;
		fread(buffer + counter, 1, stride, fd);
	}
	if(counter < filesize)
	{
		ops++;
		bytes += filesize - counter;
		fread(buffer + counter, 1, filesize - counter, fd);
	}
	gettimeofday(&end, NULL);
	print_results(stride, ops, bytes, get_time_diff(start, end));
	free(buffer);
	return get_time_diff(start, end);
}
开发者ID:dloch,项目名称:school-projects-undergrad,代码行数:25,代码来源:io_bench.c


示例16: algorithm_3

double algorithm_3(int *arr, int size, int print_option, FILE *file) {
    
    int max, beg, end;
    
    clock_t T1, T2;
    double time;
    
    T1 = clock();//start timer
    
    /***************************************************
     
     ALGORITHM 3 CODE GOES HERE
     
     *****************************************************/
    max = alg3(arr, size, 0);
    
    
    
    T2 = clock();//end timer
    time = (double)(T2 - T1) / CLOCKS_PER_SEC;//get total time
    
    beg = (int)(max_index - &arr[0]);
   
    end = beg + max_size - 1;
    
    print_results(arr, size, print_option, file, max, beg, end);
    

    
    return time;
}
开发者ID:hardesc,项目名称:Project1,代码行数:31,代码来源:algorithms.c


示例17: algorithm_4

double algorithm_4(int *arr, int size, int print_option, FILE *file) {
    
    int max, beg, end;
    
    clock_t T1, T2;
    double time;
    
    T1 = clock();//start timer
    
    /***************************************************
     
     ALGORITHM 4 CODE GOES HERE
     
     *****************************************************/
    
    max = alg4(arr, &size);
    
    T2 = clock();//end timer
    time = (double)(T2 - T1) / CLOCKS_PER_SEC;//get total time
    
    beg = *low;
    end = *high;
    
    print_results(arr, size, print_option, file, max, beg, end);
    
    return time;
}
开发者ID:hardesc,项目名称:Project1,代码行数:27,代码来源:algorithms.c


示例18: digest_data

void media_identifier::identify_data(const char *name, const uint8_t *data, std::size_t length)
{
	std::vector<file_info> info;
	digest_data(info, name, data, length);
	match_hashes(info);
	print_results(info);
}
开发者ID:qwijibo,项目名称:mame,代码行数:7,代码来源:media_ident.cpp


示例19: algorithm

void algorithm(int *arr, int size, int value, int version, FILE *file) {

    clock_t T1, T2;
    double time;
    int *outputArr;
    
    outputArr = createArr(size);
    initArr(outputArr, size);
    
    T1 = clock();//start timer
    
    //Call the appropriate algorithm on the array
    switch (version) {
        case 1 :
            outputArr = algorithm_1(arr, outputArr, size, value);
            break;
        case 2 :
            outputArr = algorithm_2(arr, outputArr, size, value);
            break;
        case 3 :
            outputArr = algorithm_3(arr, outputArr, size, value);
            break;
    }
    
    T2 = clock();//end timer
    time = (double)(T2 - T1) / CLOCKS_PER_SEC;//get total time
    
    value = sumArray(outputArr, size);
    print_results(outputArr, size, value, file);
    
    fprintf(file, "Time to execute: %fs\n", time);
    
    free(outputArr);
}
开发者ID:hardesc,项目名称:Project2,代码行数:34,代码来源:algorithms.c


示例20: algorithm_2

double algorithm_2(int *arr, int size, int print_option, FILE *file) {
    
    int i, j, s, temp, max, beg, end;
    clock_t T1, T2;
    double time;
    
    max = -32767;
    beg = 0;
    end = size - 1;
    
    T1 = clock();//start timer
    
    //beginning point incrementer
    for (i = 0; i < size; i++) {
        s = 0;
        //end point incrementer
        for (j = i; j < size; j++) {
            temp = arr[j];//for debugging
            s += arr[j];
            if (s > max) {
                max = s;
                end = j;
                beg = i;
            }
        }
    }
    
    
    T2 = clock();//end timer
    time = (double)(T2 - T1) / CLOCKS_PER_SEC;//get total time
    print_results(arr, size, print_option, file, max, beg, end);
    
    return time;
}
开发者ID:hardesc,项目名称:Project1,代码行数:34,代码来源:algorithms.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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