'\0' null character 0 '\n' newline 10 '\r' return 13 '\t' tab 9 ' ' space 32 '0' zero digit 48 'A' upper case A 65 'a' lower case a 97
float square(float x)
{
return x * x;
}
#include <iostream.h>
int main()
{
cout << square(2.0);
return 0;
}
class Circle
{
private: // the Implementation
int radius;
int centerX;
int centerY;
const float PI = 3.14159;
public: // the Interface
Circle(int newX, int newY, int newRadius)
{
centerX = newX;
centerY = newY;
radius = newRadius;
}
float area()
{
return PI * radius * radius;
}
};
#include <iostream.h>
int main()
{
Circle c(0,0,1);
cout << "The area of Circle c is " << c.area() << endl;
return 0;
}
{
Circle c(0,0,1); // c is born
... // c is alive - we can ask it's area
} // c dies - no more Circle c
{
float i = 0.0;
// float i is in scope
{
int i = 0; // outer float i is hidden by local integer i
// int i is in scope
}
// float i is back in scope
// int i is out of scope
}
// both the objects named i are out of scope