I have been trying to work on this program that takes a "necklace program" that I wrote and puts the results of that program into a multiplication table. I am doing it using a value returning function but keep getting the following errors and have no clue what they mean. Could anyone give me some tips?
error C2082: redefinition of formal parameter 'num1'
error C2082: redefinition of formal parameter 'num2'
{
Here is my program.
Code:# include <cmath> # include <iostream> using namespace std; # include <iomanip> int necklace( int, int); int main () { cout << setw(5) << " "; int count; count = 1; while ( count <= 15) { cout << setw(5) << count; count++; } cout << endl; count = 1; cout << setw(5) << " "; while (count <=15) { cout << setw(5) << "___"; count++; } cout << endl; int column, row; column = 1; while (column <=15) { cout << setw(3) << column << "|"; row = 1; while ( row <=15) { int l; l = necklace(row, column); cout << setw(5) << l; row++; } cout << endl; column++; } } int necklace( int num1, int num2) { int num3, num4, input1, input2, length, newNumber, newDigit; bool notDone; input1=num3; input2=num4; length=0; notDone= true; while (notDone) { newNumber = num1+num2; newDigit = newNumber % 10; length = length+1; num3 = num4; num4 = newDigit; if (num3 == input1 && num4 == input2) { notDone= false; } } return length; }



LinkBack URL
About LinkBacks


