home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
for4.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-22
|
733b
|
34 lines
// Program that demonstrates using the continue statement
// to skip iterations.
#include <iostream.h>
#include <math.h>
double f(double x)
{
return sqrt(x * x - 9);
}
main()
{
double x, y;
cout << " X";
cout << " f(X)\n";
cout << "_________________________________\n\n";
// for loop with empty parts
for (int i = -10; i <= 10; i++) {
if (i > -3 && i < 3)
continue;
x = (double)i;
y = f(x);
cout << " ";
cout.width(3);
cout << x << " ";
cout.width(7);
cout << y << "\n";
}
return 0;
}