Author Topic: why doesn't cin work?  (Read 2016 times)

0 Members and 1 Guest are viewing this topic.

Offline vipulan12Topic starter

  • Robot Overlord
  • ****
  • Posts: 181
  • Helpful? 0
why doesn't cin work?
« 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;
}

Offline vipulan12Topic starter

  • Robot Overlord
  • ****
  • Posts: 181
  • Helpful? 0
Re: why doesn't cin work?
« Reply #1 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?

 


Get Your Ad Here

data_list