I'm trying to get this while loop to work but I keep getting errors (as usual)
Here's what I have:
It's supposed to display a table of intergers (1 thru 5) and their squares.Code:#include <iostream> using namespace std; void instructions (); void calculations (); int header; int table; int main () { instructions (); calculations (); header; table; return 0; } void calculations () int header() { cout << "TABLE OF NUMBERS AND THEIR SQUARES" << endl; cout << " Number Square " << endl; cout << " ------ ------ " << endl; return 0; } int table() { int num, square; num = 0; while (num <= 5) { square = num * num; if (num < 5) cout << " " << num << " " << square << endl; else cout << " " << num << " " << square << endl; num = num + 1; } return 0; }
Thanks for your help.