You always need to pay attention to what your compiler tells you, and it's a great way to learn. You need to work on fixing these errors:
loopTst.cpp: In function `int main()':
loopTst.cpp:17: error: invalid conversion from `int*' to `int'
loopTst.cpp:4: error: too few arguments to function `void findSquare(int, int)'
loopTst.cpp:17: error: at this point in file
loopTst.cpp: In function `void findSquare(int*)':
loopTst.cpp:25: error: expected primary-expression before ';' token
loopTst.cpp:25: error: `b' undeclared (first use this function)
loopTst.cpp:25: error: (Each undeclared identifier is reported only once for each function it appears in.)
loopTst.cpp:27: error: `j' undeclared (first use this function)
loopTst.cpp:28: error: expected `;' before '}' token
loopTst.cpp:31: error: `a' undeclared (first use this function)
loopTst.cpp:31: error: `mySquare' undeclared (first use this function)
loopTst.cpp:31: error: name lookup of `i' changed for new ISO `for' scoping
loopTst.cpp:25: error: using obsolete binding at `i'
loopTst.cpp:29: warning: unused variable 'newArray'
Unless your assignment explicitly requires you to use an array for this problem, don't; there's no need for an array. Try to explain to yourself what every part of your code is doing. In many cases you should be telling yourself, "that makes no sense!". The simple fix for your code is this:
#include
using namespace std;
void findSquare(int, int);
int main(int argc, char *argv[]) {
int a, b;
cout << "Please enter the first number : ";
cin >> a;
cout << "Please enter the second number : ";
cin >> b;
findSquare(a, b);
return 0;
}
void findSquare(int a, int b) {
for (int i = a; i <= b; i++ ) {
cout << i*i << " ";
}
cout << endl;
}
#if 0
Sample run:
Please enter the first number : 2
Please enter the second number : 9
4 9 16 25 36 49 64 81
#endif