Exforsys
+ Reply to Thread
Results 1 to 2 of 2

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 ...

  1. #1
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128

    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


  2. #2
    caradoc is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    122
    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++.


Latest Article

Network Security Risk Assessment and Measurement

Read More...