7.1
#include<iostream>
void simple();
int main()
{
using namespace std;
cout << "main() will call the simple() function:\n";
simple();
cout << "main() is finished with the simple() function.\n";
system("pause");
return 0;
}
void simple()
{
using namespace std;
cout << "I'm but a simple function.\n";
}
7.2
#include<iostream>
void cheers(int);
double cube(double x);
int main()
{
using namespace std;
cheers(5);
cout << "Give me a number: ";
double side;
cin >> side;
double volume = cube(side);
cout << "A" << side << "-foot cube has a volume of ";
cout << volume << " cubic feet.\n";
cheers(cube(2));
system("pause");
return 0;
}
void cheers(int n)
{
using namespace std;
for (int i = 0; i < n; i++)
cout << "cheers! ";
cout << endl;
}
double cube(double x)
{
return x*x*x;
}