Discussion in 'C++' started by westjon64, Oct 12, 2005.

  1. westjon64

    westjon64 Guest

    i am fairly new to c++, i need to know how to make it so you can input
    decimals into a file using the cin >> a command instead of just being
    able to input whole numbers and also how to make it so that it outputs
    decimals and not just rounded off whole numbers
    westjon64, Oct 12, 2005
    1. Advertisements

  2. westjon64

    Artie Gold Guest

    What have you tried? (Show us some brief *real* code.)

    Have you looked at a book? (See for suggestions.)

    This ain't rocket surgery...

    Artie Gold, Oct 12, 2005
    1. Advertisements

  3. You need to decalre you variables as float or double.

    double x;
    cin >> x;
    cout << x;

    BTW they are called floating point numbers, not decimals.

    John Harrison, Oct 12, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.