Some observations:
(1) As already mentioned by others, your source file must be
part of the project being built. If you haven't done that then
a Build/Rebuild may show success from the build as it will have
built an empty project (minus your source code.)
(2) If there are any missing parts of a build - such as occurs
when there are compile or link errors or no code provided - then
no exe will get created. So naturally you will get an error
when you try to Run it - there isn't any exe to run.
(3) Avoid using Run or Run without debugging when learning
how to use VS - it just creates confusion as most starters
often only look at the end result - the last error message
received - and fail to check the earlier messages from the
build which show where the problems began. Always do a Build
or Rebuild first, and only use Run/Run without debugging when
all build errors (and preferably all warnings as well) have
been corrected.
(4) You mention Turbo C++ and the code you posted would
be common for very old versions of Turbo C++. But the C++
language has changed significantly since your examples
(and book) were created. The code you posted will not
compile without error in VC++ or any other compilers
from the past decade or two.
Specifics;
#include <iostream.h>
is no longer correct as all C++ headers have had the
.h extension removed. The correct form now is:
#include <iostream>
Also:
cout << "Hello...";
The streams are now in the std namespace, so that must be
specified for cout, cin, etc.
std::cout << "Hello...";
There are alternative ways to specify the namespace such as:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello...";
}
OR
#include <iostream>
using std::cout;
int main()
{
cout << "Hello...";
}
Note that main should always return an int, as prescribed by
the C++ Standard. Some compilers will still accept void main()
but it should be avoided.
If you are using a book published 20+ years ago then you
really need to use a much more current text.
- Wayne