Is it possible to have a c++ program like this…
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
And have it’s output on a webpage like this…
<html>
<head>
<title>C++</title>
</head>
<body>
<div src = "cpp.exe"></div>
</body>
</html>
Not in the HTML per se, no. But if your server supports it (e.g., Apache), you can use a server-side include to execute a program and include the output on the web page.
Your HTML page would look like this:
It isn’t a very good approach because there are better ways to produce dynamic content. But if you really, really need to do it this way, that’s how…