Get this little program to run. Then, modify it to read an int rather than a double. Note that sqrt() is not defined for an int so assign n to a double and take sqrt() of that.
How should I do this? I get error message when trying do change the code.
#include<iostream>
int main()
{
std::cout<< "Please enter a integer value:";
int n;
std::cin>>n;
double nAsDouble = static_cast<double>(n);
std::cout<< "n =="<<n
<< "\nn+1 =="<<n+1
<< "\nthree times n=="<<3*n
<< "\ntwice n=="<<n+n
<< "\nn squared=="<<n*n
<< "\nhalf of n=="<<n/2
<< "\nsquare root of n=="<<sqrt(nAsDouble)
<< "\n"; // another name for newline ("end of line") in output
return 0;
}