c++ online compiler

Jan 3, 2013 at 4:42pm
Hello!
I wrote :

#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
cout<<a;
return 0;
}


on the page:

http://ideone.com/UEl0JA
It does not give me the option to imput at all and writes its random number

WHat is wrong?
Many thanks!
Last edited on Jan 3, 2013 at 4:52pm
Jan 3, 2013 at 4:55pm
closed account (3qX21hU5)
Code looks fine to me you should use spaces though (example cin >> a;).

What are you typing in the command prompt? Are you entering a number? Character?

I have a feeling you are trying to type a character in there. int can only hold whole numbers. If you want to hold a character (example 'a') use char a;. Or if you want to hold a word use string a;.

Note: When you use string you must include the proper header files #include <string> and using declarations using std::string; (You don't need this because you have using namespace std;
Jan 3, 2013 at 4:57pm
Hi,

First, it would be a good habit to use the code tags to post code here!

Second, your code is correct and even compiles for me in Code::Blocks, my guess is that your online IDE just doesn't provide an input for your program. Use Code::Blocks (or any other offline IDE) instead.
Jan 3, 2013 at 4:58pm
You have to click the input button or upload with new input under the code pane.
Last edited on Jan 3, 2013 at 4:59pm
Jan 3, 2013 at 5:27pm
naraku9333, what do u actally mean? I need the onlineone that I done have to download...
Jan 3, 2013 at 5:28pm
what online c++ compiler works properly? I am in such a position that I dont have permission to download...
Jan 3, 2013 at 5:29pm
The link is on the page, it's called:

upload with new input
Jan 3, 2013 at 5:36pm
sorry, no help by using spaces...I tried...
Jan 3, 2013 at 5:56pm
On the page you linked on ideone.com, under your source code there is a link labeled 'upload with new input' click it and add your input into the text field.
Jan 3, 2013 at 5:59pm
"upload with new input " works for me.
Topic archived. No new replies allowed.