Write a C++ Program that input into 1-D array of 15 values. It fill the array then draw the bars one by one of the histogram.
#include <iostream>
int main()
{
int arr[15] = { 0 };
for (int i = 0; i < 15; i++)
{
std::cout << "Enter vaule number " << i + 1 << " : ";
std::cin >> arr[i];
}
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < arr[i]; j++)
{
std::cout << char(219);
}
std::cout << std::endl;
}
system("pause");
return 0;
}
Comments
Leave a comment