CrazyEngineers Forum

******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more?
Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Reply

  #1 (permalink)
Old 8th September 2008, 07:26 PM
CE - Apprentice
 
simple's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 18th November 2007
Posts: 22
Default strange thing in VC++

i wrote the following code snippet in Visual C++ 6.0
#include "h1.h"
int main()
{
cout<<"\nHello \n";
printf("\nWelcome!!!");
return 0;
}
strange thing is that "welcome" gets displayed first and "hello" thereafter....
why is "welcome" getting executed first??

i have included stdio.h and iostream.h in h1.h.
any suggestions?
__________________
History will be kind to me for I intend to write it!!!
---Sir Winston Churchill
simple is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)
Old 9th September 2008, 12:59 AM
CE - Apprentice
 
samboy2005's Avatar
 
I'm a Crazy Electronics and communication Engineer
Join Date: 8th September 2008
Posts: 20
Default Re: strange thing in VC++

i think printf command has higher priority then cout .....
haven't been in touch for long time with VC++..not very sure .but think this might be the case .
samboy2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 10th September 2008, 01:45 AM
CE - Apprentice
 
simple's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 18th November 2007
Posts: 22
Default Re: strange thing in VC++

no i guess i found the answer
cout is buffered, so if i add an endl at the end of cout it works perfectly fine!!
any other reply is still welcome!!
thanks n c ya!!
__________________
History will be kind to me for I intend to write it!!!
---Sir Winston Churchill
simple is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 10th September 2008, 05:12 PM
CE - Apprentice
 
I'm a Crazy Computer Engineer
Join Date: 24th July 2008
Posts: 46
Default Re: strange thing in VC++

I dont know the answer but I am not convinced with your answer the reason is that if YOU HAVE

cout<<"Aaaaa";
printf("ddddd");
count<<"bbbbb";

so in this case Aaaaa and bbbb would print sep??
niraj.kumar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 12th September 2008, 02:11 PM
CE - Apprentice
 
simple's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 18th November 2007
Posts: 22
Default Re: strange thing in VC++

dddd gets printed first and then aaaa and then bbbbb
so what do you make of this??
__________________
History will be kind to me for I intend to write it!!!
---Sir Winston Churchill
simple is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 08:14 PM.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.Ad Management by RedTyger