online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include<map> #include<string> //class representing a single question struct Question{ std::string question; std::string arr[3]; int correctAnswer; }; void quiz(const Question& q){ std::cout<<q.question<<std::endl; for(int i = 0; i<3; i++){ std::cout<<i+1<<". "<<q.arr[i]<<std::endl; } int answer; std::cin>>answer; (answer == q.correctAnswer) ? std::cout<<"Correct\n"<<std::endl : std::cout<<"Inorrect\n"<<std::endl; } int main(){ //create object 1 of type Question Question obj1{"What is the biggest animal in the world?", {"Dolphin", "Clownfish", "Narwhal"}, 3}; //pass obj1 to function quiz(obj1); //create object 2 of type Question Question obj2{"What is the biggest animal in the world?", {"Blue Whale", "Elephant", "Great White Shark"}, 1}; //pass obj2 to function quiz(obj2); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue