Exforsys

Online Training

Best Alternative

This is a discussion on Best Alternative within the C and C++ forums, part of the Programming Talk category; I know one way of getting input from users is using scanf. But my friend told me that in real ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-07-2007, 11:10 AM
Senior Member
 
Join Date: Apr 2006
Posts: 153
cyrus is on a distinguished road
Best Alternative

I know one way of getting input from users is using scanf. But my friend told me that in real programming applications it is not good to sue scanf and it is always better to void scanf. Is this true and why is it so? If so what can be the best alternative for scanf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-11-2007, 04:38 PM
Senior Member
 
Join Date: Apr 2006
Posts: 144
caradoc is on a distinguished road
cin is another way of getting input in C++ programming language. In C++ it is better to use scanf than cin. This is because cin takes much more time than scanf. The reason for this in cin it is necessary to specify the data type of input each time. But in scanf it is not so. It has format specifier which clearly depicts the data type used. So if there are larger say millions of records to be inputted to reduce time it is better to go for scanf than cin statement in C++. The same reason holds for cout and with printf concept also in C++.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Solaris x86 FAQ 2/2 Dan Anderson Tech FAQ 0 04-27-2004 08:24 PM


All times are GMT -4. The time now is 08:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.