|
-
March 2nd, 2006, 06:32 AM
#6
Re: Traversing arrays problem
ok, one more question, how can i get a user to input a number, then the program to search for it's index in the array and print the index, and if the number does not exist it will say "number does not exist" ?
#include <algorithm> // for min_element/max_element
#include <iostream> // for cout
using namespace std;
int main()
{
int array[] = {1,12,32,45,56,89,122};
int ivalue;
cout << "please enter the value you are looking for\n";
cin >> ivalue;
cin.get();
cin.get();
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|