is there a built in function to deal with numbers similar to how the swap member function (first.swap(second);) deals with strings? thanks
GPXtC02 0 Light Poster
Recommended Answers
Jump to Post>is there a built in function to deal with numbers similar to how the swap member function
Yes, include <algorithm> and you can use the std::swap template function as AD has shown.
Jump to Post>Narue its a part of utility.h in VS2008 and in Utility.h and xstring on VS2005.
That's nice. And your point is?
Jump to Post>swap(Scores[0], Scores[min]);
>swap(Scores[1], Scores[min]);
>swap(Scores[2], Scores[min]);
>swap(Scores[3], Scores[min]);
This strikes me as a type mismatch. Most likely you're trying to swap a float with an array of floats, and the compiler doesn't like it.
Jump to PostPost a complete (small!) program that exhibits the problem, please.
All 13 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
Laiq Ahmed 42 Junior Poster
Narue 5,707 Bad Cop Team Colleague
GPXtC02 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
GPXtC02 0 Light Poster
GPXtC02 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
GPXtC02 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
GPXtC02 0 Light Poster
GPXtC02 0 Light 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.