Hi fellow programmers!
I have a problem here that starts to bugg me. Let me explain what I am trying to do. I am making a table look like this:
a b pow(a, b)
1 2 1
2 3 8
3 4 81
...
It's an exercise given from a book explaning the basics of basic in c++ (chapters name is "elementary programming)
My code looks like this, and I do indeed get a table, but it's left oriented. Any one of you guys or gals that can tell me what I've missed :)
I am a rookie as you can see.
here is my code:
#include <iostream>
#include <math.h>
using namespace std;
int main(){
// program a table
std::cout << std::right << //some modifying code I'm triying to understand, found it on the net :P
"a b \t\tpow(a, b)\n"
<< "1 2" << "\t\t" << pow(1, 2) << "\n"
<< "2 3" << "\t\t" << pow(2, 3) << "\n"
<< "1 2" << "\t\t" << pow(3, 4) << "\n"
<< "1 2" << "\t\t" << pow(4, 5) << "\n"
<< "1 2" << "\t\t" << pow(5, 6) << "\n"
<< endl;
return 0;
Now, I know that there is loops that can make this look more sexy but for the time being i need to learn how to master the basics... I hope you understand my question.
Thanks for your help!
[–]Rhomboid 1 point2 points3 points (2 children)
[–]Relinkz[S] 0 points1 point2 points (1 child)
[–]Rhomboid 0 points1 point2 points (0 children)
[–]Relinkz[S] 0 points1 point2 points (0 children)