c++ online compiler

I wrote :

using namespace std;
int main(){
int a;
return 0;

on the page:

It does not give me the option to imput at all and writes its random number

WHat is wrong?
Many thanks!
Last edited on
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;

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.
You have to click the input button or upload with new input under the code pane.
Last edited on
naraku9333, what do u actally mean? I need the onlineone that I done have to download...
what online c++ compiler works properly? I am in such a position that I dont have permission to download...
The link is on the page, it's called:

upload with new input
sorry, no help by using spaces...I tried...
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.
"upload with new input " works for me.
Topic archived. No new replies allowed.