Shane,
Thanks for your input. For the moment I have removed the header file
#include <stdlib.c>
From the c++ program. In a for loop part, I had a set of statements to
output the values where the number was a triangular and square at the same
time in two lines. This was where the program was failing to compile and I
was concluding incorrectly that it had to do with the stdlib.h or cstdlib.h
file.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int i;
int n;
int k;
cout << "This program searches for numbers that\n";
cout << "are both square and triangular\n";
cout << "Up to what number do you want to search?\n\n";
cout << "Enter number: ";
cin >> n;
for (i=1; i<n; i++)
{
k = (i*(i+1))/2;
if (sqrt(k) - int(sqrt(k)) == 0)
cout << "\n" << k << " is a triangular number when i = " << i << "." <<
endl;
}
cout << "\n\n";
return 0;
}
About the big number, it would be nice to get it working for bigger
numbers, but I would need to run it on amd64 freebsd machine at work.
Maybe at some other time we can revisit this issue. Thank you for your
assistance.
When running the program if I enter a number like 10,000,000 I get bad
output. If I stop at 1,000,000 I get correct output.
https://oeis.org/search?q=0%2C1%2C36%2C1225%2C41616%2C&language=english&go=Search
Best Regards,
Antonio