March 17th, 2014, 01:13 PM
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 diﬀerent 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. Overﬂow 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
March 17th, 2014, 02:54 PM
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 https://creativecommons.org/publicdomain/zero/1.0/
C, C++ Compiler: Microsoft VS2017
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!