473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

multiple parameters with vectors

cdg
Is there any reason why code passing multiple parameters with a vector
is not legal.
I have left out most of the unneccessary details to try and make the
problem clearer. Earlier in the program the vector is passed without any
problems, but it was the only parameter.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& cards,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call
//*** I am getting an error message here, saying
// "illegal use of this type as an expression"
}

void CompareValues(vector<int>& any_vector, int result, int ct)
{

}
Mar 5 '06 #1
3 2514
cdg
This is the correct code to show the problem. There were different vector
names in the previously posted code that I had changed just to post the
problem with multiple parameters.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& any_vector,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call
//*** I am getting an error message here, saying
// "illegal use of this type as an expression"

}

void CompareValues(vector<int>& any_vector, int result, int ct)
{

}
Mar 5 '06 #2
cdg a écrit :
Is there any reason why code passing multiple parameters with a vector
is not legal.
I have left out most of the unneccessary details to try and make the
problem clearer. Earlier in the program the vector is passed without any
problems, but it was the only parameter.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& cards,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call


Try

CompareValues(any_vector, result, cnt);

Do not put the argument type in the function call.
Mar 5 '06 #3
cdg
I tried it and it did work. And I actually had written it correctly
earlier in the program, but I didn't notice it this time.
Mar 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CoolPint | last post by:
Can anyone kindly explain why non-type template parameters are required by giving some examples where their uses are clearly favourable to other alternatives? I cannot think of any good use for...
5
by: lugal | last post by:
This might be more appropriate here. I'm new to C++, coming from a background in another languages that allowed a similar solution to work (Python). I wrote the following code in C++ based on the...
1
by: Steven K | last post by:
Hello, I am calling a SQL Server 2K parameter query with the following: Dim spWebDocGroup As OleDb.OleDbDataReader Dim prmWebDocGroup As OleDbParameter Dim cmdWebDocGroup As New...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
21
by: utab | last post by:
Hi there, Is there a way to convert a double value to a string. I know that there is fcvt() but I think this function is not a part of the standard library. I want sth from the standard if...
3
by: danbraund | last post by:
Hi everyone, I'm a long time C coder, who is coding his final year project in C++ to run under the MIT click routing system. Being fairly new to the OO side of the language, my problem is this: ...
3
by: kez | last post by:
How do you read from a binary file into a structure that contains multiple vectors? For example struct studentRecords { string user; vector<string> friends; vector<string>...
5
by: xtheendx | last post by:
In my program i have three sperate vectors that store the students last name, first and score. I need to sort it by last name and print the contents of the vectors lastname, firstname: score. Well...
7
by: Rob | last post by:
This actually compiles and works but it doesn't seem like the best code, so I was wondering is there another way to do this? template <typename Tvector<T>* addDepth(T) { return new vector<T>;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.