Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int count = 10;
- int data[count] = {10,5,8,7,3,15,13,23,14,20};
- string character = "^";
- int hrow = 0;
- for(int i=0;i<count;i++){
- if(data[i]>hrow){
- hrow=data[i];
- }
- }
- string vStr[hrow][count];
- for(int i=0; i<hrow; i++){
- for(int j=0; j<count; j++){
- if(i >=data[j]){
- vStr[i][j]= " ";
- }else {
- vStr[i][j]= "$";
- }
- }
- }
- for(int i=0; i<hrow; i++){
- for(int j=0; j<count; j++){
- cout<<vStr[i][j]<<" | ";
- }
- cout<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment