Board index » off-topic » Console Applications C++ Borland Builder 5 (Standard ) Beginner Advise Please
Dermot
Delphi Developer |
Console Applications C++ Borland Builder 5 (Standard ) Beginner Advise Please2005-04-17 01:47:02 AM off-topic15 I don't know if this is the correct forum for this posting. If not I appologise....if so...please advise the correct forum for it. I want to know how to run the following code(inserted at the end of this posting). I have read that it has to be created in a "Console Application". File | New | Console Application....is as far as I got. Can anyone explain to me where I enter the code.Is it above, below or between the curly braces in this section of the .cpp file? //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop //--------------------------------------------------------------------------- #pragma argsused int main(int argc, char* argv[]) { return 0; } //---------------------------------------------- The basic code I want to run is as follows:- #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<double>v; double d; while(cin>>d) v.push_back(d); // read elements if (!cin.eof()) { // check if input failed cerr << "format error\n"; return 1; // error return } cout << "read " << v.size() << " elements\n"; reverse(v.begin(),v.end()); cout << "elements in reverse order:\n"; for (int i = 0; i<v.size(); ++i) cout << v[i] << '\n'; return 0; // success return } Please advise Thanks Dermot |