Comparing execution times
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Comparing execution times

  1. #1
    Join Date
    Mar 2014

    Comparing execution times

    Hi, I am working on a program for a school assignment. I am not sure exactly how to code this at all. If anyone could help, that would be very much appreciated. This is the problem:


    Write a C++ program that compares the execution time of the above summation using two different solutions: one that uses loops, and another that uses the closed form approach. Use large values of n for the comparisons, such as, 10^7, 10^8, 10^9, 10^10, 10^11,10^12, 10^13, and 10^14. Provide a comparison table for the execution time in both solutions.Do not worry about the value of the actual sum. Overflow will occur in the sum value rendering it invalid; however, this is not the primary concern of the program. Execution time is the primary concern.

    Thank you for your help

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: Comparing execution times

    So how far have you got with this assignment and what is your c++ programming question - as writing code to actually produce the sum in the two ways mentioned is fairly trivial? How have you been told to obtain the execution time of a portion of code? If you post the code you have so far we'll provide guidance and advice.

    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain

    C, C++ Compiler: Microsoft VS2017

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

HTML5 Development Center