| | |
help with finding minimum value
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2006
Posts: 11
Reputation:
Solved Threads: 0
need help in findin the minimum of these 5 inputs
its keeps showin 2 instead of 1...
its keeps showin 2 instead of 1...
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int findMin(int [], int); int main() { const int MAXELS= 5; int nums[MAXELS] = {2, 18, 1, 27, 16}; cout << "The minimum value is " << findMin(nums, MAXELS) << endl; system("pause"); return 0; } // find the minimum value int findMin(int vals[], int MAXELS) { int i, min = vals[0]; for (i = 1; i >= MAXELS; i++) if (min >= vals[i]) min = vals[i]; return min; }
for (i = 0; i < MAXELS; i++)
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- Programing functions and having a problem with one of the functions. (C++)
- Homework Help. (C++)
- Need help with while loop (C++)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
- finding area of something (Computer Science)
Other Threads in the C++ Forum
- Previous Thread: converting std::string to const chars?
- Next Thread: what is error with this ...
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






