Advertisement
cd62131

Line

Jun 29th, 2014
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main() {
  5.   vector<int> v;
  6.   int count = 0;
  7.   while (true) {
  8.     cout << "値" << count + 1 << "? ";
  9.     int in;
  10.     cin >> in;
  11.     if (in == -1) break;
  12.     v.push_back(in);
  13.     count++;
  14.   }
  15.   for (int i = 0; i < count; i++) {
  16.     cout << i + 1 << ": ";
  17.     for (int j = 1; j <= v[i]; j++) cout << "#";
  18.     cout << endl;
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement