| ny24gray (27) | |
|
How can I write a program that takes an array of float and prints its contents to the nearest integer using print integers and void integer? | |
|
|
|
| Moschops (5956) | |
|
I've no idea what a void integer is, but here's a helpful thread: http://www.cplusplus.com/forum/beginner/3600/ | |
|
|
|
| Peter87 (3672) | |
|
In C++11 you have std::round that can be used to round to the nearest integer value. http://en.cppreference.com/w/cpp/numeric/math/round | |
|
|
|
| ny24gray (27) | |
|
I have to write two functions in addition to main?? int round (float x) which would round any float to the nearest int, and return the int value and void print_integers(float a [ ], int size) which would print the contents of array of size, size a already rounded to the nearest int. | |
|
|
|
| ny24gray (27) | |
| Anyone able to help? | |
|
|
|
| Volatile Pulse (1328) | |||
You haven't even made an attempt to code either function, or you haven't posted code. I'm not going to right it for you, but, I'll give you an overview of what the functions should do:
| |||
|
Last edited on
|
|||
| Natalyias77 (10) | |
|
I'm glad you didn't write it for him. This is the same assignment that I have and I am trying to get it to run. BUT I do like how you formatted your answer. Do you do that type of process for all your functions? Its very organized and it helped me as well!! | |
|
|
|