















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















double x = static_cast
int x, y; x = y = 0;
if ( x = 0 ) { ... // condition always false!
if ( x == 0 ) { ...
abs acos asin atan atan2 cos cosh exp fabs fmod log log10 pow sin sinh sqrt tan tanh
y
./testMath > outputFile.txt
cout.setf(ios::fixed); cout.precision(4);
cout.setf(ios::scientific);
cout.width(5); cout << x; cout.width(10); cout << y; cout.width(10); cout << z << endl;
int x = 5; for (int i=0; i<n; i++){ int y = i + 3; x = x + y; } cout << "x = " << x << endl; // OK cout << "y = " << y << endl; // BUG -- y out of scope cout << "i = " << i << endl; // BUG -- i out of scope
int x = 5; { double x = 3.7; cout << "x = " << x << endl; // will print x = 3. } cout << "x = " << x << endl; // will print x = 5
using std::cout; using std::endl; int main(){ cout << "Hello" << endl; ...
int main(){ std::cout << "Hello" << std::endl; ...
using namespace std; int main(){ cout << "Hello" << endl; ...
using namespace aNameSpace; int main(){ cout << x << endl; // uses aNameSpace::x ...
double ellipseArea(double, double);
double ellipseArea(double, double);
double ellipseArea(double a, double b){ return PIab; } double volume = ellipseArea(a, b) * height;
void showProduct(double a, double b){ cout << "ab = " << ab << endl; }
showProduct(3, 7);