Answer to Question #294369 in C++ for Shan

Question #294369

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.


1
Expert's answer
2022-02-06T03:52:05-0500
#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;
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog