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
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
Related Q & A:
- How to Convert a C++ Structure into C# Structure?Best solution by Stack Overflow
- How to convert a char array into an int in C++?Best solution by Stack Overflow
- Why cant i view my contacts display image? please help if you know ,thanks?Best solution by Yahoo! Answers
- I have a problem with webcam help me please.Best solution by Yahoo! Answers
- Anybody psychic or clairvoyant? I really need some help and advice please. Please see question below?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.