Neb <n...@nowhere.com> wrote:
> In compiling I am recieving the error:
> Error E2293 test.ccp 4: ) expected
You're invoking the C compiler, not the C++ compiler, perhaps because
the extension you're using is ".ccp", not the conventional ".cpp".
As a beginner, I suggest you not call any program "test", only to save
yourself some confusion and frustration. On systems other than
Windows, there is usually a program called "test", often /bin/test.
Unless you're careful, you'll invoke that test instead of yours.
Besides, you'll have a lot of tests. Make a test directory, call it
"t", and put your program in it. This one might be called
"t/swap.cpp".
And use <iostream>, not <stdio.h>. It's typesafe, and it's fun. :-)
> Im new to c/c++ programming and am having difficulty in passing more > than one parameter into and out of a function.
Note up front: Since this is a moderated group, you have a rather high
latency until your posting shows up. For complex questions, this doesn't
matter, but for short questions I'd either suggest the dedicated
beginners' group (comp.lang.learn.c-c++) or one of the C++ channels on
IRC, where you might get help in real time.
> #include <stdio.h>
If any book starts with teaching printf(), it is probably a bad book for
learning C++, provided you want to learn C++ and not C. Note that it
isn't clear which of those two _distinct_ languages you want to learn.
Note that in <algorithm> (or was it <utility>?) is a function called
std::swap() which does exactly the above.
> Error E2293 test.ccp 4: ) expected
I haven't tried it but the code is C++ and seems actually okay. However,
I think you are compiling it with a C compiler, is that possible? The C
compiler then chokes on the references, which only C++ supports. Also
note that typically, C++ source files are called "cpp" and not "ccp".