| | |
Find function
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2004
Posts: 3
Reputation:
Solved Threads: 0
Hi! I need help with the find function! I do not know how to use it in finding numbers.
For instance:
1 1 1 1 2 3 4 4 5 5 6 6 6 7 7 7 7
Using the find function, it will count the number of times a number appears.
1: 4 times
2: 1 time
3: 1 time
4: 2 times
5: 2 times
6: 3 times
7: 4 times
I need help with this, please! Thanks
For instance:
1 1 1 1 2 3 4 4 5 5 6 6 6 7 7 7 7
Using the find function, it will count the number of times a number appears.
1: 4 times
2: 1 time
3: 1 time
4: 2 times
5: 2 times
6: 3 times
7: 4 times
I need help with this, please! Thanks
yeah .. this my assignment in the past .. try it .. it work fine .. 

C++ Syntax (Toggle Plain Text)
#include <iostream.h> #include <stdlib.h> main() { // int array[10]={1,2,3,4,5,6,7,8,9,10}; int left=0,right=9,middle; int number,i; bool sw=false; // cout<<"ARRAY: "; for (i=0;i<=9;i++) { cout<<array[i]<<";"; } cout<<" \n"<<"Number to find: "; cin>>number; while (sw == false && left <= right) { middle=(left+right)/2; if (number == array[middle]) { sw=true; cout<<"number found.\n"; } else { if (number < array[middle]) right=middle-1; if (number > array[middle]) left=middle+1; } } if (sw == false) cout<<"number not found.\n"; system("Pause"); }
Real Eyes Realize Real Lies
My Resume
My Resume
![]() |
Similar Threads
- In VB6.0 How do i want to find function get path windows fonts directory? (Visual Basic 4 / 5 / 6)
- Best way to implement the find Function (ASP.NET)
- script to find function names (Shell Scripting)
- find function not working (C++)
- Use TaxtBox value in Find function in VBA (Visual Basic 4 / 5 / 6)
- <map> find function (C)
- use of "find" in the algorithm function (C)
Other Threads in the C++ Forum
- Previous Thread: C/Dos Programming
- Next Thread: compile error-chained hash table c++
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets





