| enemy (17) | |
|
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
|
|
| Zereo (428) | |
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;
| |
|
|
|
| Marcan (24) | |
|
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. | |
|
|
|
| naraku9333 (1038) | |
| You have to click the input button or upload with new input under the code pane. | |
|
Last edited on
|
|
| enemy (17) | |
| naraku9333, what do u actally mean? I need the onlineone that I done have to download... | |
|
|
|
| enemy (17) | |
| what online c++ compiler works properly? I am in such a position that I dont have permission to download... | |
|
|
|
| Marcan (24) | |
|
The link is on the page, it's called: upload with new input | |
|
|
|
| enemy (17) | |
| sorry, no help by using spaces...I tried... | |
|
|
|
| naraku9333 (1038) | |
| 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. | |
|
|
|
| Chervil (1206) | |
| "upload with new input " works for me. | |
|
|
|