Calculating work using dot product in C++
using namespace std should be avoided

Not much more to say than that. Just don't do it. The worst case is putting it into a header. Next is using it outside any namespace, so you've done the second worst possible incarnation of this particular problem.

Typing std::cout instead of cout really isn't going to cause you a lot of problem, I promise.

Don't Repeat Yourself

You have essentially identical code for entering the two input vectors. You probably want to use a function to enter the values for a vector, and just call it once for each input vector.

Use the Library

As a general rule, I'd avoid using built-in arrays when at all reasonable. In this case, you can use std::array instead:

std::array&lt;double, 3&gt; F;
std::array&lt;double, 3&gt; s;


The standard library already provides std::inner_product to do exactly the calculation you're doing. You might as well use it:

double W = std::inner_product(F.begin(), F.end(), s.begin(), 0.0);