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(t2 -t1).count();

cout << "sum: " << sum << endl;

cout << "duration: " << duration << endl;

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!