Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- vector<int> v;
- int count = 0;
- while (true) {
- cout << "値" << count + 1 << "? ";
- int in;
- cin >> in;
- if (in == -1) break;
- v.push_back(in);
- count++;
- }
- for (int i = 0; i < count; i++) {
- cout << i + 1 << ": ";
- for (int j = 1; j <= v[i]; j++) cout << "#";
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement