Hello everyone,
I am working with functions now and tryin to understand them.
I have been practicing different ways for using them.
such as below:
Code:int greetings(); // this is a prototype
int age();
int main()
{
int greetings(); // this is a function header
{ // start of function body
char name[20];
cout << "Please enter your name? ";
cin >> name;
cout << "Hello "<< name <<"\n";
} //end of function body
cout <<"Enter your age? ";
int age();
{
int age;
cin >> age;
cout << "You are " << age << " years old\n\n";
}
/* Next I would like to use my greetins function again in
my program: */
int greetings(); // :here
return 0;
}
What I would like to learn next is how to use the same functions over in the program.
I would normally use a loop to repeat this code but I want to know how to reuse the functions in the program.