Write a program that does the following:
• Input is a list of (any number of) n positive integers, terminated by input of -1.
• Output is a (sideways) histogram which represents the list of numbers. Specifically, the output consists of n lines. Each line i consists of x asterisks, where x is the ith number in the input.
1
Expert's answer
2011-11-04T09:51:01-0400
// Histogram of the entered values.cpp : Defines the entry point for the console application. //
using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int value; int countfor1=0; int countfor2=0; int countfor3=0; int countfor4=0; int countfor5=0; int arrayvalue[1000]; cout<<"Enter value:"; for(;;){ cin>>value; if(value>=1 && value<=5){ if(value==1){ countfor1++; } if(value==2){
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment