How can I convert a string number to a number in Perl?

C++ error, help me please (cant convert int to int [])?

  • warGame(w); for function void warGame (int war [ ]) // POST: display the hand of cards { int card3; // card number int s3; // suit number 0 .. 3 int r3; // rank number 0 .. 12 string suits3 [4] = {"Clubs", "Diamonds", "Hearts", "Spades" }; string ranks3 [13] = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; cout << "Your army:\n"; for (int k = 0; k < 4; k++) { card3 = war[k]; s3 = card3 /13; r3 = card3 % 13; cout << ranks3[r3] << " of " << suits3[s3] << endl; } cout << endl; } error says: cannot convert parameter 1 from 'int' to 'int []'

  • Answer:

    Im assuming this is how you are calling the function right? warGame(w); is the variable "w" an integer array? It should be. Another possible problem is your declaration of the function. It should be: void warGame (int war [ ]);

Hayden at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Im assuming this is how you are calling the function right? warGame(w); is the variable "w" an integer array? It should be. Another possible problem is your declaration of the function. It should be: void warGame (int war [ ]);

justme

Your war function needs an integer array as argument and that is been used in the function also. You are calling it with an integer. I am not sure what for you are calling this function. It needs an array, you are sending an integer. Thus, you are getting this error. It all depends upon you how this function you are going to use.

James Bond

Your function takes an int[] (an array of ints) as a parameter. You're passing it a single int.

Silent

Your war function needs an integer array as argument and that is been used in the function also. You are calling it with an integer. I am not sure what for you are calling this function. It needs an array, you are sending an integer. Thus, you are getting this error. It all depends upon you how this function you are going to use.

James Bond

Your function takes an int[] (an array of ints) as a parameter. You're passing it a single int.

Silent

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.