Computer Science Canada Write a simple source code |
Author: | jhooper3581 [ Fri Aug 28, 2009 7:25 am ] |
Post subject: | Write a simple source code |
Output: "C++ programming is fun!" Write a C++ source code that will give the correct output given above |
Author: | A.J [ Fri Aug 28, 2009 8:47 am ] | ||
Post subject: | RE:Write a simple source code | ||
|
Author: | jhooper3581 [ Fri Aug 28, 2009 8:50 am ] |
Post subject: | |
Thanks for the reply! |
Author: | saltpro15 [ Fri Aug 28, 2009 11:07 am ] | ||
Post subject: | RE:Write a simple source code | ||
an alternative
|
Author: | bbi5291 [ Fri Aug 28, 2009 11:18 am ] | ||
Post subject: | Re: Write a simple source code | ||
Shortest code contest!
|
Author: | wtd [ Fri Aug 28, 2009 11:55 am ] | ||
Post subject: | Re: RE:Write a simple source code | ||
saltpro15 @ Sat Aug 29, 2009 12:07 am wrote: an alternative
No return type for "main" is being bad. Also, if memory serves, the C++ standard says that main implicitly returns zero if no explicit return is coded. |
Author: | A.J [ Fri Aug 28, 2009 1:22 pm ] |
Post subject: | RE:Write a simple source code |
How about we open a new thread for an obfuscated code contest? |
Author: | bbi5291 [ Fri Aug 28, 2009 1:24 pm ] | ||
Post subject: | Re: RE:Write a simple source code | ||
wtd @ Fri Aug 28, 2009 11:55 am wrote: No return type for "main" is being bad. Also, if memory serves, the C++ standard says that main implicitly returns zero if no explicit return is coded. Fine then.
|
Author: | rdrake [ Fri Aug 28, 2009 2:01 pm ] |
Post subject: | RE:Write a simple source code |
Didn't the OP ask for C++ code? |
Author: | Zren [ Fri Aug 28, 2009 2:06 pm ] |
Post subject: | Re: Write a simple source code |
Write a C++ source code that will give the correct output given above. Mwahaha, never said it had to compile. I rename my empty source code file to "C++ programming is fun!.cpp". None of your sass bout how the filename isn't actually the file itself either. >,< |
Author: | saltpro15 [ Fri Aug 28, 2009 2:31 pm ] |
Post subject: | Re: RE:Write a simple source code |
A.J @ Fri Aug 28, 2009 wrote: How about we open a new thread for an obfuscated code contest?
I'm on it. |
Author: | bbi5291 [ Fri Aug 28, 2009 2:40 pm ] |
Post subject: | Re: RE:Write a simple source code |
rdrake @ Fri Aug 28, 2009 2:01 pm wrote: Didn't the OP ask for C++ code?
It is C++. Try compiling it as C. |
Author: | rdrake [ Fri Aug 28, 2009 3:48 pm ] |
Post subject: | Re: RE:Write a simple source code |
bbi5291 @ Fri Aug 28, 2009 2:40 pm wrote: rdrake @ Fri Aug 28, 2009 2:01 pm wrote: Didn't the OP ask for C++ code?
It is C++. Try compiling it as C. 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." |
Author: | md [ Fri Aug 28, 2009 3:59 pm ] |
Post subject: | 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++. |
Author: | bbi5291 [ Fri Aug 28, 2009 5:06 pm ] |
Post subject: | 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 main[] = {...}; ). Obviously this goes against the spirit of writing a solution in C++, but oh well... |
Author: | S_Grimm [ Fri Aug 28, 2009 9:34 pm ] |
Post subject: | 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. |
Author: | [Gandalf] [ Fri Aug 28, 2009 10:52 pm ] |
Post subject: | 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. ![]() |
Author: | saltpro15 [ Fri Aug 28, 2009 11:00 pm ] |
Post subject: | RE:Write a simple source code |
wow, this topic has come a long way from outputting "C++ Programming is fun!" ![]() |
Author: | wtd [ Fri Aug 28, 2009 11:51 pm ] | ||
Post subject: | Re: Write a simple source code | ||
Not quite the message the OP wanted, but it is idiomatic.
|
Author: | rdrake [ Fri Aug 28, 2009 11:55 pm ] | ||
Post subject: | Re: Write a simple source code | ||
wtd @ Fri Aug 28, 2009 11:51 pm wrote: Not quite the message the OP wanted, but it is idiomatic.
Now you're talking. Glad to see somebody knows how to write real C++
![]() |
Author: | bbi5291 [ Sat Aug 29, 2009 10:21 am ] |
Post subject: | Re: Write a simple source code |
If that were real C++, then any sane C++ programmer would be using Java instead. But wait, that hasn't happened... |
Author: | wtd [ Sat Aug 29, 2009 10:45 am ] |
Post subject: | RE:Write a simple source code |
It's showing you the power of using the << operator. And yes, that's real C++ code. |
Author: | bbi5291 [ Sat Aug 29, 2009 10:52 am ] |
Post subject: | Re: Write a simple source code |
Of course, I didn't mean to assert that it's fake C++ code. What I meant is that if C++ is expected to look like that for such a simple program, nobody would ever use it to write such a program. |
Author: | A.J [ Sat Aug 29, 2009 11:50 am ] |
Post subject: | RE:Write a simple source code |
Not here, not now. This thread was merely used to answer jhooper3581's question. If you have anything else to discuss, do it elsewhere. [No, I have every right to state my opinion. I am not suggesting that any action should be taken, just that I believe that they ought to take the conversation elsewhere.] |
Author: | bbi5291 [ Mon Aug 31, 2009 9:24 am ] | ||
Post subject: | Re: Write a simple source code | ||
Just for fun.
|