Why does the Compiler ask for input before showing Output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does the Compiler ask for input before showing Output?

cout<<"Wie hiess die ehemalige Landeshauptstadt Deutschlands mit Sitz in NRW?"<<endl; cout<<"a) Duisburg"<<endl<<"b) Essen"<<endl<<"c) Bonn"<<endl; cin>>answ; that is a part of my Code for a little Quiz I'm building but when I want to run it in the Compiler of this App it FIRST asks for input before even showing the question. Thanks im advance for every Kind of help

25th Jun 2016, 11:00 AM
Demex
13 Answers
+ 2
The compiler in this app does not work like an usual compiler. Compile the code using a true C++ Compiler and it should work fine. This is because this app sends the data over the Internet to compile it, and not locally so it is actually being ran on another computer and the result is sent back to you. As said, compile it on your computer and it should work fine.
25th Jun 2016, 1:23 PM
hyrex
hyrex - avatar
+ 1
ummm......what compiler are you using...
25th Jun 2016, 1:06 PM
Mukul Kumar
Mukul Kumar - avatar
+ 1
.....or online good compilers like codechief or others (google it) you can do it from your phone too
25th Jun 2016, 1:25 PM
Mukul Kumar
Mukul Kumar - avatar
0
Can I see all code? and please in english,it hard to read
25th Jun 2016, 11:32 AM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
0
#include <iostream> #include <string> using namespace std; int main() { char answ, r_answ; string q, a, b, c, player, h_player; int points, high; cout<<"What is the name of the former capital of germany which was located in Northrine Westfalia?"<<endl; cout<<"a) Duisburg"<<endl<<"b) Essen"<<endl<<"c) Bonn"<<endl; cin>>answ; if(answ==c){ cout<<"Correct Answer!"; } else{ cout<<"Wrong answer..."; } return 0; }
25th Jun 2016, 11:41 AM
Demex
0
Oh understand what you want now.You want to see question and answer,right?
25th Jun 2016, 11:59 AM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
0
I want the Compiler to print first the question + possible answers and THEN Demand an input but somehow it asks for an input before printing ANYthing
25th Jun 2016, 12:02 PM
Demex
0
Yep it's same.I think You must make delay time for cin.One code can do but I already forget :P.
25th Jun 2016, 12:14 PM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
0
never had a Problem like that xd
25th Jun 2016, 12:18 PM
Demex
0
Arrr I'm really confuse wanna submit button or ikkyusan?
25th Jun 2016, 12:25 PM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
0
me too
25th Jun 2016, 1:09 PM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
0
Thanks for the last answer that's what I needed to know xD
25th Jun 2016, 1:26 PM
Demex
0
bro What kind of that program on phone?
25th Jun 2016, 1:27 PM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar