I am trying to create a multiplication table that is left aligned with a line under the header and a line next to the first column on the left. What I have here gives me what I want but without the lines. Can anyone help?
1. #include <iostream>
2..#include <iomanip>
3. using namespace std;
4. //program that computes a multiplication table, basic formatting or
5. int main() {
6. int i,j;
7. //first print out the header
8. cout << setw(5) << std::left << " ";
9. for(i=1; i<=10; i++) {
10. cout << setw(5) << i;
11. }
12. cout << endl;
13. //now print out the table
14. for(i=1; i<=10; i++) {
15. //print out the row
16. cout << setw(5) <<std::left << i;
17. for(j=1; j<=10; j++) {
18. cout << setw(5) << std::left << i*j;
19. }
20. cout << endl;
21. }
22. return 0;
23.}