Since this is a C++ forum, a couple of C++ approaches:
1 2 3 4 5 6 7 8 9
#include <string>
#include <iostream>
int main()
{
int n = 10;
char c = 'z';
std::cout << std::string(n, c) << '\n';
}
or
1 2 3 4 5 6 7 8 9 10 11
#include <algorithm>
#include <iostream>
#include <iterator>
int main()
{
int n = 10;
char c = 'z';
fill_n(std::ostream_iterator<char>(std::cout), n, c);
std::cout << '\n';
}