GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #11  
Old 02-Nov-2004, 11:47
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by LuciWiz
You should be careful about your statements. Some people don't use the same compiler as you do (I am guessing .NET?); in VC++ 6, for example, cout has nothing to do with std.

Yes I agree with you there. I retracted and apologized a few posts back then, realizing the posed problem was beyond my scope of knowledge, stepped aside and waited to hear what the knowledgeable people had to say. Oh, and I am using gcc 3.3.3 cygwin special and bash 2.04b. As far as std and cout not being related I guess it is just my compiler that complained about a void main and cout being undeclared until I include iostream and add using namespace std; But hey, I'm just a new guy that didn't read the original post closely enough.

Quote:
Originally Posted by LuciWiz
As for your little "competition", I honestly found the "problem" easy to solve; I don't mean to be haughty or anything....If you really want too, i could send you my solution; actually, I am really curious about the C version; I mean I'm not sure if someone didn't find a nicer solution than mine; maybe we could just post it here, since this is still a forum

I think this is for dsmith and WaltP. I believe they were PM'ing the possible solutions (so as not to spoil the surprise) to the problem.

I do agree with your signature. Unfortunately I still both try and fail on a regular basis.

Thanks for your time.
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #12  
Old 02-Nov-2004, 11:51
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by LuciWiz
You should be carefull about your statements. Some people don't use the same compiler as you do (I am guessing .NET?); in VC++ 6, for example, cout has nothing to do with std.


Best regards,
Luci

I'm not sure why you say this. The following will not compile with Visual C++ Version 12.00.8804 (Part of my installation of VC++ 6)

CPP / C++ / C Code:
#include <iostream>

int main()
{
  cout << "My World of Computing";

  return 0;
}

It needs either "using namespace std;" or "using std::cout;" or "std::cout" in place of cout.

(Also won't compile with gcc or borland bcc32.)

If you #include the deprecated <iostream.h> instead of <iostream>, it compiles and executes OK with any of these compilers, but "deprecated" means that it might not be supported in future versions of the language.

Regards,

Dave
  #13  
Old 02-Nov-2004, 12:19
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
Quote:
Originally Posted by dsmith
Well, I proved myself wrong! It is actually simpler in C (IMO). Here is the C challenge. Take this & without changing the main function, make it print "Welcome to My World of Computing"

CPP / C++ / C Code:
#include <stdio.h>

int main(){
	printf("My World of Computing");

	return 0;
}

I am actually kind of embarrased about saying that it couldn't be done in C!


What do we do if think we've solved it? You told us later to PM (which I'm assuming is personal message) it to you, but it says I don't have the right privilege to do so. You also mentioned that we shouldn't post it here as to not spoil anything. Uhh... so, what do I do?
  #14  
Old 02-Nov-2004, 12:43
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by Dr. Evil
What do we do if think we've solved it? You told us later to PM (which I'm assuming is personal message) it to you, but it says I don't have the right privilege to do so. You also mentioned that we shouldn't post it here as to not spoil anything. Uhh... so, what do I do?

Ahhhh! Post more. I can't remember how many posts you have to have for PM priviliges.

Or if you have I/M you could post it or allow me to contact you by email. If none of those work, I will post an email address that you can send it to, that i will delete once you have seen it.
  #15  
Old 03-Nov-2004, 00:57
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by davekw7x
If you #include the deprecated <iostream.h> instead of <iostream>, it compiles and executes OK with any of these compilers, but "deprecated" means that it might not be supported in future versions of the language.


Indeed, I was talking about the "deprecated" version of the header. And yes, it is not supported in the future versions (that's why I thought he was using .NET ). However, if we go one or two compilers back, we won't be able to compile the "improved" version (some people still use 4.0!)


Quote:
Originally Posted by cable_guy_67
Yes I agree with you there. I retracted and apologized a few posts back then, realizing the posed problem was beyond my scope of knowledge, stepped aside and waited to hear what the knowledgeable people had to say.

Oh, but I was NOT aiming for apologizes; I was just saying that it was not necessarily a mistake. It was just something added to your response, which on some compilers was appropiate; I apreciated your post, as it was helpfull to people who used for example .NET and tried to compile that piece of code.
Actually, if this was understood as a reproach, it is I who must apologize.

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #16  
Old 03-Nov-2004, 08:41
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by LuciWiz
Indeed, I was talking about the "deprecated" version of the header. And yes, it is not supported in the future versions (that's why I thought he was using .NET ). However, if we go one or two compilers back, we won't be able to compile the "improved" version (some people still use 4.0!)





Kind regards,
Luci

Of course the program (with void main() and with <iostream> but without the std namespace being referenced) will not compile at all with any compiler compliant with the C++ standard.

I am sure that you, Luci, know this, but people new to C++ read these messages all of the time without knowing what the heck we are talking about. In particular lots of tutorials and even some current books still have examples that use void main() and they use cout, cin, endl, etc., without any reference to namespaces. New people wonder why programs like this don't compile, and/or give messages like 'cout undeclared'.

In general, "old" c++ compilers didn't require any namespace qualifications, since the original release of c++ didn't place any emphasis on namespaces. Nowadays, things like cout and other thingies from <iostream> are part of the std namespace, and programs must specify that somehow (perhaps using one of the three methods that i suggested previously). Use of <iostream.h> is still allowed, for now, for compatibility with old stuff, and <iostream.h> "conveniently" wraps up cout, etc. into the std namespace without requiring any designation of the namespace.

Sometimes beginners are given the advice to use <iostream.h> instead of being enlightened as how to use std namespace correctly. I say, "let the sun shine in."

Just my .02 euros.

Regards,

Dave
  #17  
Old 03-Nov-2004, 09:59
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
I completely agree.

Quote:
Originally Posted by davekw7x
Just my .02 euros.

Loved this. Wonder what Darrin has to say about it

Regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #18  
Old 03-Nov-2004, 17:11
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by LuciWiz
Loved this. Wonder what Darrin has to say about it

Regards,
Luci

Darrin is confused! Why would I have anything to say about that?
  #19  
Old 04-Nov-2004, 11:11
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by dsmith
Darrin is confused! Why would I have anything to say about that?

Hm...
Well, I thought it was a little joke reffering to the way you sometimes end your posts:

Quote:
Originally Posted by dsmith
Just my 2 cents...

I guess this saying is that ordinary in the US that I'm the only one who cracks up about it?
Oh well, it's probably just my european humour

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #20  
Old 04-Nov-2004, 11:25
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by LuciWiz
Hm...
Well, I thought it was a little joke reffering to the way you sometimes end your posts:



I guess this saying is that ordinary in the US that I'm the only one who cracks up about it?
Oh well, it's probably just my european humour

Kind regards,
Luci

Well, I used to offer my "two cents worth" from time to time, but with the current exhange rate, I'll go for euros.

Dave
(Left Coast, USA)
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help with coding expectation maximization needed. thanks edge C Programming Language 8 08-Nov-2005 06:00
Some small things Allowee GIDSearch™ 6 14-Jul-2004 02:40
This is a small snippet from a much larger piece. Tang_Quester Open Discussion Forum 1 19-Mar-2004 02:17
Free 1st month / Free setup / No credit card needed...Plans start at 4.95 LarryIsaac Web Hosting Advertisements & Offers 0 11-Oct-2003 15:03
Script needed for letting user input a few days of data for tracking and analysis. tradertt MySQL / PHP Forum 3 06-Mar-2003 03:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:34.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.