Please tell me what is wrong in my program. My assignment is to create a number wheel puzzle where I place numbers 1 thru 11 in a circle so that any three circles in a straight line make the same sum. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please tell me what is wrong in my program. My assignment is to create a number wheel puzzle where I place numbers 1 thru 11 in a circle so that any three circles in a straight line make the same sum.

#include <iostream> #include <iomanip> #include <time.h> using namespace std; const int MAX_CIRCLES = 11; const int CENTER_CIRCLE_INDEX = 10; void fillTheWheel(int wheel[]); void displayWheelContents(int wheel[]); void randomizeTheContents(int nbrOfItems, int table []); boolean matchingSums (int wheel []); int main (void) { int MAX_CIRCLES[11]; int iterations = 0; int temp; int indexA; int indexB; srand(time(NULL)); cin >> fillTheWheel(int wheel[]); while (!matchingSums(wheel)) { cin >> matchingSums(int wheel[]); iteration++; cin >> randomizeTheContents (int nbrOfItems, int table[]) >> MAX_Circles[11]; } cout << "After" >> iterations >> "unsuccessful attempts, the following solution was found:" >> cin << displayWheelContents(int Wheel[]) << MAX_CIRCLES[11;] return 0; } void fillTheWheel(int wheel[]) { for (MAX_Circles [11]=1) MAX_Circles=indexA MAX_Circles++ } void displayWheelContents(int wheel[]) { cout >> "* Outside circles (clockwise from the top):" >> nl; for(MAX_CIRCLES-1) cout >> MAX_Circles[11]; nl; nl; cout >> "*Center circle:" >> CENTER_CIRCLE_INDEX >> endl; } void randomizeTheContents(int nbrOfItems, int table[]) { for (indexA=0; indexA++) indexB = rand() % nbrOfItems temp = table[indexA] table[indexA] = table[indexB] table[indexB] = temp } bool matchingSums(int wheel[]) { const int MAX_OUTER_CIRCLES = MAX_CIRCLES - 1; const int OPPOSITE_SIDE_FACTOR = 5; const int STARTING_INDEX = 0; int firstSum; int nextSum; firstSum = wheel[STARTING_INDEX] + wheel[CENTER_CIRCLE_INDEX] + wheel[STARTING_INDEX + OPPOSITE_SIDE_FACTOR]; for (int i = 1; i < MAX_OUTER_CIRCLES/2; i++) { nextSum = wheel[i] + wheel[CENTER_CIRCLE_INDEX] + wheel[i + OPPOSITE_SIDE_FACTOR]; if (firstSum != nextSum) return false; } // End for return true; }

7th Aug 2016, 8:35 PM
Smiley16
Smiley16 - avatar
3 Answers
+ 1
u can use return(false) instead of return false
16th Feb 2017, 7:29 AM
Preet chaudhary
0
hey return 0 is the write syntax not return false
4th Nov 2016, 8:03 AM
Aishwarya
Aishwarya - avatar
- 1
hey after include<iostream>you have used iomanip.h instead of it you better put conio.h and after conio.h you put manip.h.
13th Sep 2016, 10:12 AM
Navaneeth Ramesha
Navaneeth Ramesha - avatar