Quote Originally Posted by TheMightyJoda View Post
Alrighty, im trying to make a game using Health bars that are illustraed by the following

"Health: |||||||||||||||||"

and i wanted to know if p1Health was my int variable (int p1Health; ) representing player 1's health, how i can make that output the same number of "|"s. So if p1Health = 20, i want the code to output "||||||||||||||||||||".
Code:
#include <string>
#include <iostream>

int main()
{
    int p1Health = 10;
    std::string strHealth(p1Health, '|');
    std::cout << strHealth;
}
Regards,

Paul McKenzie