Answer to Question #27666 in C++ for Darren Jackson
How to write the function?
void print (const float x[], const int n){
for ( const float *p = x; p != x + n; ++p ) cout << ’\t’ << *p;
cout << endl;
}
1
2013-04-04T02:55:08-0400
#include <iostream>
using namespace std;
void print(const float x[], const int n)
{
for (int k = 0; k < n; k++)
cout << '\t' << x[k];
cout << endl;
}
int main()
{
float x[] = {3.2, -5.14, 9.8};
print(x, 3);
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment