Hi i have made this simple code:
Code:
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
int MyArray[10];
for(int i=0;i<10;i++){
cout<<setw(7)<<"MyArray["<<i<<"] = "<<i<<endl;
cout<<setw(16)<<"Value for Element "<<i<<" = "<<1+rand()%10<<endl;
}
system("PAUSE");
return 0;
}
my problems are:
1. i want to make an Histogram, for the random value..
for example if i have a value 10, i want to print 10 asterisks..
2. how to set the output to this:
MyArray[] Value Histogram
0----------> 4 ----> ** **
1----------> 2 ----> **
Thanks in advance..