online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include "constants.h" int isPrime(int x) { int count = 0; for (int j = 1; j <= x; ++j) { if (x % j == 0) { count++; } } if (count == 2) { std::cout << x << " is prime.\n"; } else std::cout << x << " is NOT prime.\n"; return 0; } int main() { for (int i{ 0 }; i <= 11; ++i) { isPrime(constants::randomOne[i]); } }
#pragma once #ifndef CONSTANTS_H #include <string> namespace constants { constexpr int randomOne[12] = { 1,2,3,5,7,9,12,13,15,18,23,87 }; constexpr int randomTwo[12] = { 2,4,6,8,11,13,17,22,43,1,317,822 }; } #endif // !CONSTANTS_H

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