Asking for number and output a character

How would I go about asking the user for a number and outputting a * corresponding to that number. For example, if I enter 4 the computer should spit out ****.
1
2
3
4
5
6
7
8
9
10
#include <string>
#include <iostream>


int main()
{
    int x;
    std::cin >> x;
    std::cout << std::string(x, '*');
}
it couldn't be easier than that.
Topic archived. No new replies allowed.