ILE C/C++ Programmer's Guide

Creating the Source Files

The application consists of three source files, m1.cpp, m2.cpp, and m3.cpp, shown in the following figures:

Figure 15. m1.cpp -- First Source File for Application with Circular References



// m1.cpp
#include <iostream.h>
int main(void)
{
void func1(int);
int n = 0;
func1(n); // Function func1() is called.
}

Figure 16. m2.cpp -- Second Source Files for Application with Circular References



// m2.cpp
#include <iostream.h>
void func2 (int);
void func1(int x)
{
if (x<5)
{
x += 1;
cout << "This is from func1(), n=" << x << endl;
func2(x); // Function func2() is called.
}
}

Figure 17. m3.cpp -- Third Source File for Application with Circular References



// m3.cpp
#include <iostream.h>
void func1(int);
void func2(int y)
{
if (y<5)
{
y += 1;
cout << "This is from func2(), n=" << y << endl;
func1(y); // Function func1() is called.
}
}


[ Top of Page | Previous Page | Next Page | Table of Contents ]