| | |
Discrete solution help!
![]() |
I'm not sure if I understand the question correctly, but if you want a bunch of numbers which you can choose from, you could use vectors.
Example:
output:
Example:
C++ Syntax (Toggle Plain Text)
vector<int> diameters; /* load a few bogus values */ diameters.push_back(1); diameters.push_back(5); diameters.push_back(7); /*display available numbers */ cout << "numbers available: "; for (unsigned int i = 0; i < diameters.size(); i++) cout << diameters[i] << " ";
output:
numbers available: 1 5 7 If you have a finite number of values and they aren't going to change, you can get away with using a standard array instead of a vector.
This is only if you have a static amount of values and performance is an issue. If performance doesn't matter, use a vector as suggested from niek_e since you get the perks of a dynamic array as well as information about its size and the ability to use STL algorithms with it to manipulate, copy or iterate through its contents... etc.
-Alex
This is only if you have a static amount of values and performance is an issue. If performance doesn't matter, use a vector as suggested from niek_e since you get the perks of a dynamic array as well as information about its size and the ability to use STL algorithms with it to manipulate, copy or iterate through its contents... etc.
-Alex
You mean if you have a radius, circumference, etc. then solve it?
http://www.mathopenref.com/diameter.html
http://www.mathopenref.com/diameter.html
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
![]() |
Similar Threads
- Factorial of any length (C++)
- Best Video Cards (Monitors, Displays and Video Cards)
- First year assigment on reading file, sorting and outputting invoice (C++)
- Network cable is un-plugged! No it isn't. (Networking Hardware Configuration)
- need help on final year project (Java)
Other Threads in the C++ Forum
- Previous Thread: Linked List: Inserting a new node
- Next Thread: Linked List Issue
| Thread Tools | Search this Thread |
ace_thread api array based binary bitmap borland c++ c/c++ calling char class classes code coding compile console conversion count delete delete-line deploy desktop developer directshow dll download dynamic dynamiccharacterarray email embedded encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream information input int integer java lib linkedlist linker loop looping loops map math mathhomeworkhelp matrix memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion reference reverse richedit rpg string strings temperature template test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






