| | |
Discrete solution help!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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 |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker 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 rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






