Given the following C++ code
Given the following C++ code, improve the code by eliminating length calls out of the loop, put most used
variables first when initializing variables, use prefix operators rather than postfix operators, loop unrolling, and any other improvements you would like to make to improve performance. Please note, the order of the output is not important, all data should be output.
#include
#include
#include
using namespace std;
int main(int argc, char* argv[])
{
double sum=0;
vector speed;
vector ship;
vector pilot;
speed.push_back(12.0);
ship.push_back(“Millenium Falcon”);
pilot.push_back(“Han solo”);
speed.push_back(15.5);
ship.push_back(“Viper”);
pilot.push_back(“Kara Thrace”);
speed.push_back(22.0);
ship.push_back(“Serenity”);
pilot.push_back(“Malcolm Reynolds”);
for(int i=0; i {
cout cout cout cout cout
return 0;