--- layout: exercise language: "cpp" permalink: /Modules/Cpp/CppIntro title: "C++ Basics" canvasasmtid: "090211" canvaspoints: 3 info: points: 3 instructions: "Create a method printDivisibleBy6() which takes one argument, and which prints the numbers from 6 up to and including the specified argument that are divisible by 6. Please put a space in between each number. As a hint, logical AND is also && in C++, just as it is in Java. So for a number to be divisible by 6, you should use this to check that the number has a remainder of 0 when divided by 2, and also by 3." goals: - Declare methods in C++ - Work with loops in C++ - Use conditionals in C++ - Use basic print statements in C++ processor: correctfeedback: "Correct!!" incorrectfeedback: "Try again" submitformlink: false feedbackprocess: | var pos = runtime.text.trim(); correctcheck: | pos.includes("6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 126 132 138 144 150 156 162 168 174 180 186 192 198 204 210 216 222 228 234 240 246 252 258 264 270 276 282 288 294 300 306 312 318 324 330 336 342 348 354 360 366 372 378 384 390 396 402 408 414 420 426 432 438 444 450 456 462 468 474 480 486 492 498 .6 12 18 24 30 36 42 48") incorrectchecks: - incorrectcheck: | pos.includes("61218") feedback: "Try again. Please print exactly one space after each number." - incorrectcheck: | pos.includes("0 6 12") feedback: "Try again. Start looping at 6, not 0" files: - filename: "student.cpp" name: student ismain: false isreadonly: false isvisible: true code: | #include // TODO: Fill in your printDivisibleBy6() method here - filename: "driver.cpp" name: main ismain: true isreadonly: true isvisible: true code: | int main() { printDivisibleBy6(500); printf("."); printDivisibleBy6(50); printf("\n"); } openFilesOnLoad: ["driver.cpp", "student.cpp"] ---