Answers for "print space in array cpp"

C++
1

print array elements with space c++

#include <iostream> // cout
#include <iomanip> // setw
int main()
{
    int array[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };       
    for (auto n : array)
    {
        std::cout << std::setw(4) << n;
    }
}
Posted by: Guest on October-31-2020
1

print space in array cpp

cout << array << " ";
Posted by: Guest on December-04-2020
0

print array elements with space c++

const int n = 10;
int array[n] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i=0;i<n;i++)
    printf("%4d",array[i]);
Posted by: Guest on October-31-2020

Browse Popular Code Answers by Language