Question
THIS IS A C++ ASSIGNMENT #include #include using namespace std; using namespace std::chrono; int main() { cout < < How many items should be summed?
THIS IS A C++ ASSIGNMENT
#include
#include
using namespace std;
using namespace std::chrono;
int main() {
cout << "How many items should be summed? ";
int items;
cin >> items;
int* data;
//TODO: Create your dynamic array, it should be items big
//TODO: Fill your dynamic array with the values 1 through items
//used for timing
high_resolution_clock::time_point t1 = high_resolution_clock::now();
//this variable will accumulate your sum
long long int sum = 0;
//TODO: create a for loop that loops over your array, summing all data in the array
//Grab the time again now that youre done
high_resolution_clock::time_point t2 = high_resolution_clock::now();
long long int duration = duration_cast
cout << "sum: " << sum << endl;
cout << "duration: " << duration << endl;
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started