How do I write this very simple program?

Often, especially at the start of semesters, I get a lot of questions about how to write very simple programs. Typically, the problem to be solved is to read in a few numbers, do something with them, and write out an answer. Here is a sample program that does that:
PHP Code:
using namespace std;

int main()

double d;
cin>>dv.push_back(d);    // read elements
if (!cin.eof()) {        // check if input failed
cerr << "format error\n";
1;    // error return

cout << "read " << v.size() << " elements\n";

cout << "elements in reverse order:\n";
        for (
int i 0i<v.size(); ++icout << v[i] << '\n';

0// success return