Your question doesn't make sense. "Mental Arithmetic" means specifically that only the human brain is used. Therefore there can be no code. Even if it did, we don't provide fully coded answers to problems that sound like homework on this site.
Try to re-phrase your question and show us what effort you have put into solving it and you will get some help.
my task is to find the square roots using mental arithmetic. can you tell me what i have to do. i don't know how to put the mental arithmetic in a c++ program
We're not going to simply do your homework for you. First, you must discover a way to calculate a square root. When you've got that, come back and we'll help you write code to do those steps.
If you don't care how you do it, the <cmath> library includes sqrt()
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << "Please enter a number: ";
double a;
cin >> a;
double answer = sqrt(a);
cout << "Please enter a number to guess that the square root of the previous number is equal to your guess: ";
double g;
cin >> g;
cout <<"The square root of the first entered number is :" << answer << "\n";
if(a = g*g) cout <<"The square root of your guessed number is approximately equal to the square root of the pervious number"<< "\n"<< "\n";
else cout << "The square root of your guessed number is not equal to the square root of the previous number";
cout << "\n";
system ("pause");
return 0;
}
"Mental arithmetic" is not some technical coding term. It means "inside your own head". How do you find a square root inside your own head, without calculator or writing anything down? That ios mental arithmetic.