/* This program demonstrates the use of void functions and global and local scope. * Void functions are those that don't return any value. The return tyoe for hese functions is "void". * Functions can also take no parameters. To do this, just open and close the parentheses on the argument list. * Global variables are variables that are delcared oustside any function. * Global variables are alive from their declaration until the end of the program. * Global variables are automatically intialized with the type appropriate null value. 0 for number types, '\0' for char, false for bool, etc. * Local variables are variables declared inside functions. * They are alive from their declaration until the next '}' * You can have global and local variables with the same name. The compiler looks for the most recent declaration of the name. * To force the compiler to look past thr most recent declaration, use the scope resolution operator :: */ #include using namespace std; // use void as a return type when a function doesn't return a value // ideal for print functions int value; //this is a global variable void print(int lines) { //This will kinda draw a cat cout<<"\t\\ /\\"<>value; return value*value; // This squares the local variable //return ::value*value; This would have multiplied the global variable with the local variable. } int main() { print(4);// This will print cat without apology print(12);// This will print cat with apology cout<<"Enter a number: "; cin>>value; // Control look for local variable. finds none. So reads into global variable cout<<"The square is "<