Society of Robots - Robot Forum

Software => Software => Topic started by: vipulan12 on November 10, 2013, 05:26:31 PM

Title: why doesn't cin work?
Post by: vipulan12 on November 10, 2013, 05:26:31 PM
 hi, i am learnign c++ but the cin function isnt working?
i am using eclipse with minigw
cout works but not cin
when i enter a value on the console the program terminates

here is my code:

#include <iostream>
#include <stdio.h>
using namespace std;

int main ()
{
  int i;
  cout << "Please enter an integer value: ";
  cin >> i;
  cout << "The value you entered is " << i;
  cout << " and its double is " << i*2 << ".\n";
  return 0;
}
Title: Re: why doesn't cin work?
Post by: vipulan12 on November 10, 2013, 06:15:23 PM
i was able to fix it after restarting closing and re opening the application why did that fix the program?