/************************************************
** In this example, I'm simply trying to
** print out the character E five times. I.e.
** Answer is: EEEEE
** but when run this program I get
** Answer is: 1.56403e+09
** So what's going on, and what could I do to fix
** the problem?
************************************************/
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
string pow(char c, int k);
int main()
{
char c = 'e';
int t = 5;
cout << "Answer is: " << pow(c - 32,t) << endl;
return 0;
}
string pow(char c, int k)
{
string ans = "";
for(int i = 0; i < k; i++)
ans += c;
return ans;
}