What's the easiest way to obtain an array element from a user and placing it into memory? As a result, I need to read double values and call an already written function to read these values.
Help?
This is a discussion on Obtaining array dimension within the C++ Programming forums, part of the General Programming Boards category; What's the easiest way to obtain an array element from a user and placing it into memory? As a result, ...
What's the easiest way to obtain an array element from a user and placing it into memory? As a result, I need to read double values and call an already written function to read these values.
Help?
1)Obtaining array dimension
For char arrays:
strlen() in <cstring>
char text[] = "Hello world.";
cout<<strlen(text);
For strings:
length() in <string>
string text;
cout<<text.length();
Other arrays:
sizeof(array_name)/sizeof(array_name[0])
2)What's the easiest way to obtain an array element from a user and placing it into memory?
3)As a result, I need to read double values and call an already written function to read these values.Code:double numbers[20]; for(int i=0; i<20; i++) { cout<<"Enter a floating point number:"; cin>>numbers[i]; }
some_function(numbers);
Last edited by 7stud; 06-03-2003 at 06:41 PM.
thank you sir - i'll let you know how hte program goes as i'll be needing help thanks!