I don't understand functions that accept a variable number of arguments. I want to make a program with a max function taking any number of type double and returns the greatest of them
jray344
0
Newbie Poster
Recommended Answers
Jump to Postsee this thread that was posted only a couple hours ago.
Jump to Post> I want to make a program with a max function taking any number of type double
> and returns the greatest of them.
So store them in an array (or better yet, a vector) and write a function which accepts that array (or better yet, a vector).The …
Jump to Post> I want to make a program with a max function taking any number of type double and returns the greatest of them
for a small number of arguments (upto about seven or so), you could use overloaded function names.
#include <iostream> #include <algorithm> template< typename …
Jump to Postno. i really meant even without gcc 4.3
i would use something like a std::vector< boost::any >
or a std::list< boost::variant<int,double,std::string> >
both of which are typesafe. and i would get the same functionality.
i also would not write functions that took several dozens of arguments; so even the overloaded …
All 16 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Salem
5,138
Posting Sage
vijayan121
1,152
Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
iamthwee
vijayan121
1,152
Posting Virtuoso
vijayan121
1,152
Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
vijayan121
1,152
Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
Ancient Dragon
commented:
great solution
+20
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
jray344
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.