cin

This is a discussion on cin within the C++ Programming forums, part of the General Programming Boards category; Hello. I have a pretty simple question. Is it possible to cin >> an integer? like this: #include <iostream.h> int ...

  1. #1
    31173 h4x0r gnu-ehacks's Avatar
    Join Date
    Nov 2001
    Posts
    556

    cin

    Hello. I have a pretty simple question.

    Is it possible to cin >> an integer? like this:

    #include <iostream.h>

    int main()
    {
    int input[5];

    cin >> input;

    cout << input;

    return(0);
    }

    I ask because I don't have my VC++ up and running yet.
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    not really.You are declaring an array but you dont need one. this is the amended code...
    Code:
    #include <iostream.h> 
    int main() 
    { 
    int input; 
    cin >> input; 
    cout << input; 
    return(0); 
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    Re: cin

    I think no because u must put the element to input the number.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin problem
    By mikahell in forum C++ Programming
    Replies: 12
    Last Post: 08-22-2006, 12:14 PM
  2. cin not allowing input after first use of function
    By Peter5897 in forum C++ Programming
    Replies: 5
    Last Post: 01-31-2006, 06:29 PM
  3. Overriding Cin with Cout
    By Tainted in forum C++ Programming
    Replies: 5
    Last Post: 10-06-2005, 03:57 PM
  4. multiple instances of cin
    By Chaplin27 in forum C++ Programming
    Replies: 4
    Last Post: 10-08-2004, 05:51 PM
  5. C++ Cin Help!
    By silverfoxtp in forum C++ Programming
    Replies: 9
    Last Post: 09-15-2003, 05:38 PM

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