Wednesday, 7 May 2014

day 46

the use of functions in C++ is great for creating much more complicated programs. using them allows the programmer to split tasks throughout the program and making them able to run one at a time instead of all at once. For example;


#include <iostream>
using namespace std;

void class();
void school();

int main()
{
class();
school();
}
void  class()
{
cout<<"class has begun now!\n";
}
void school()
{
cout<<"school is now over!\n";
}
this allows for the program to split up the processes so that more than one thing can be accomplished with the single program compared to being restricted to one thing and one thing only.
Taking into account that functions still need to be called this allows the user to be able to call them and end them when needed for functionality of the program or the needs of the software.

No comments:

Post a Comment