
-----------------------------------
jhooper3581
Fri Aug 28, 2009 7:25 am

Write a simple source code
-----------------------------------
Output: "C++ programming is fun!" 

Write a C++ source code that will give the correct output given above

-----------------------------------
A.J
Fri Aug 28, 2009 8:47 am

RE:Write a simple source code
-----------------------------------

#include
using namespace std;

int main()
{
    cout ,<

-----------------------------------
saltpro15
Fri Aug 28, 2009 2:31 pm

Re: RE:Write a simple source code
-----------------------------------
How about we open a new thread for an obfuscated code contest?

I'm on it.

-----------------------------------
bbi5291
Fri Aug 28, 2009 2:40 pm

Re: RE:Write a simple source code
-----------------------------------
Didn't the OP ask for C++ code?

It is C++. Try compiling it as C.

-----------------------------------
rdrake
Fri Aug 28, 2009 3:48 pm

Re: RE:Write a simple source code
-----------------------------------
Didn't the OP ask for C++ code?

It is C++. Try compiling it as C.You're using C functions and a C header file pretending it's C++ code.  Just saying.

Sure you can compile C as C++, but why not use the C++ equivalents when available?  After all, C++ is more than just "C with classes."

-----------------------------------
md
Fri Aug 28, 2009 3:59 pm

RE:Write a simple source code
-----------------------------------
Just because you need the C++ compiler, doesn't mean it's C++. If you use C libraries for things like basic IO you're not writing C++.

-----------------------------------
bbi5291
Fri Aug 28, 2009 5:06 pm

Re: Write a simple source code
-----------------------------------
OP already received a satisfactory answer from posters before me. I was just having a bit of fun. As far as I am concerned, anything that compiles under a C++ compiler is C++. Even if you write it in machine code (this is actually possible, if you were wondering: char mainspirit of writing a solution in C++, but oh well...

-----------------------------------
S_Grimm
Fri Aug 28, 2009 9:34 pm

RE:Write a simple source code
-----------------------------------
I agree with bbi5291. If it compiles and runs under a C++ compiler, it can be considered C++ code. Even if it uses outdated header files and code. But hey, im not judgemental.

-----------------------------------
[Gandalf]
Fri Aug 28, 2009 10:52 pm

RE:Write a simple source code
-----------------------------------
Come on now, arguing semantics has never gotten anyone anywhere.

If you're writing 90% inline assembly, I think we can all agree that, even if you consider that C++ code, it's definitely not idiomatic C++ code. :)

-----------------------------------
saltpro15
Fri Aug 28, 2009 11:00 pm

RE:Write a simple source code
-----------------------------------
wow, this topic has come a long way from outputting "C++ Programming is fun!" :lol:

-----------------------------------
wtd
Fri Aug 28, 2009 11:51 pm

Re: Write a simple source code
-----------------------------------
Not quite the message the OP wanted, but it is idiomatic.

#include 
#include 

class Greeter
{
    private:
        std::string name;

    public:
        Greeter(std::string n);

        const std::string get_name();

        friend std::ostream& operator