scanf

This is a discussion on scanf within the C++ Programming forums, part of the General Programming Boards category; I have a program written in C that I would like to convert to C++ but the scanf command is ...

  1. #1
    Unregistered
    Guest

    scanf

    I have a program written in C that I would like to convert to C++

    but the scanf command is not accepted by C++

    Is that normal???? what is scanf equivalant to in c++?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    68
    scanf("%type",&variable);

    cin >> variable;//type auto detected

    Thanks
    Pratik

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    11
    you can write a program that will change it for you, it would take about an hour, and come in handy if you ever need to do it again.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    52
    but the scanf command is not accepted by C++
    Is that normal???? what is scanf equivalant to in c++?
    That is not normal, I think. C++ is supposed to be near fully backwards compatible.
    Turn no more aside and brood
    Upon love's bitter mysteries
    For Fergus rules the brazen cars...

  5. #5
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    >> but the scanf command is not accepted by C++

    I suppose it could be a lack of #include <stdio.h>

  6. #6
    Unregistered
    Guest
    thank you all I think I did not include stdio.h.........for now I will try using the cin command

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf() consideres useless
    By Snafuist in forum C Programming
    Replies: 15
    Last Post: 02-18-2009, 07:35 AM
  2. Help with a basic scanf procedure.
    By killpoppop in forum C Programming
    Replies: 9
    Last Post: 11-03-2008, 03:39 PM
  3. Replies: 2
    Last Post: 02-20-2005, 12:48 PM
  4. Scanf and integer...
    By penny in forum C Programming
    Replies: 3
    Last Post: 04-24-2003, 06:36 AM
  5. scanf - data is "put back" - screws up next scanf
    By voltson in forum C Programming
    Replies: 10
    Last Post: 10-14-2002, 04:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21