Thread: cin.get() aint working.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    16

    Exclamation cin.get() aint working.

    I have no idea what im doing wrong, cin.get() used to stop my programs but for somereason they nolonger do. Here is an example of when the cin.get() hasnt been stopping my code :

    #include <iostream>

    using namespace std;

    int main() {
    int x;
    int y;
    int box[2][2];
    cout<<"Please enter a number between 1 and 2\n";
    cin>>x;
    cout<<"Please enter another number between 1 and 2\n";
    cin>>y;
    box[0][0] = x*y;
    box[0][1] = x/y;
    box[1][1] = x+y;
    cout<<box[0][0]<<" "<<box[0][1]<<" "<<box[1][1];
    cin.get();
    }

    i know its simple but after it runs it just quits by its self.
    Last edited by Blips; 01-08-2005 at 10:28 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  2. cin.get(); doesn't seem to be working as expected
    By Diablo84 in forum C++ Programming
    Replies: 5
    Last Post: 03-30-2005, 07:00 PM
  3. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 08:35 PM
  4. Problems using while loop with cin.get()
    By Arooj in forum C++ Programming
    Replies: 4
    Last Post: 11-28-2004, 01:58 AM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM