#include #include using namespace std; int main() { const size_t SCREEN_WIDTH = 80; const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; unsigned int n; size_t m; int i; char sim; float lo,hi,dif, maxxs,minxs; cerr<< "enter amount of numbers"; cin>>n; vector xs(n); cerr<<"let's introduse array"; for(i=0; i < n; i++) { cin>> xs[i]; } cerr << "enter amount of intervals"; cin >> m; vector b(m); maxxs = minxs = xs[0]; for (i=0; i < n; i++) { if (xs[i] > maxxs) maxxs=xs[i]; if (xs[i] < minxs) minxs=xs[i]; } dif=(maxxs - minxs)/m; for(int i=0; i < n; i++) { bool found = false; for (int j=0; (j < m-1)&&!found; j++) { lo= minxs + j*dif; hi= minxs + (j+1)*dif; if ((lo <= xs[i]) && (xs[i] bmax) bmax=b[i]; ibmax = i; } //cout< MAX_ASTERISK) { for(int j=0; j < m; j++) { if (b[j]<100) { cout<<" "; } if (b[j]<10) { cout<<" "; } height = 76 * ( static_cast(b[j]) / bmax); hem = 76 * ( static_cast(b[j-1]) / bmax); hep = 76 * ( static_cast(b[j+1]) / bmax); cout< b[1])&&(u == hep - 1)) cout<<'v'; else cout<<'*'; } } else { if (j == m) { for (int u = 0; u < height; u++) { if ((b[m] > b[m-1])&&(u == hem-1)) cout<<'^'; else cout<<'*'; } } else { for (int u=0; u < height; u++) { sim='*'; if ((b[j] > b[j-1]) && (u == hem)) sim='^'; if ((b[j] > b[j+1])&&(u == hep)&&(u != height)&&(u != 0)) sim='V'; if ((b[j-1] == b[j+1])&&(u == hep)) sim='N'; cout<(b[j]) / bmax); hem = 76 * ( static_cast(b[j-1]) / bmax); hep = 76 * ( static_cast(b[j+1]) / bmax); cout< b[1])&&(u == b[i+1] - 1)) cout<<'v'; else cout<<'*'; } } else { if (j == m) { for (int u = 0; u < b[i]; u++) { if ((b[m] > b[m-1])&&(u == b[i-1]-1)) cout<<'^'; else cout<<'*'; } } else { for (int u=0; u < b[i]; u++) { sim='*'; if ((b[j] > b[j-1]) && (u == b[i-1])) sim='^'; if ((b[j] > b[j+1])&&(u == b[i+1])&&(u != b[i])&&(u != 0)) sim='V'; if ((b[j-1] == b[j+1])&&(u == b[i+1])) sim='N'; cout<