[[lesson_11_swapvals.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson11]$ cat -n swapvals.cpp
1 #include <iostream> 2 using namespace std; 3 4 void swap_values(float *a, float *b)

5 { 6 float temp; 7 8 temp = *a; 9 *a = *b; 10 *b = temp; 11 } 12 13 int main() 14 { 15 float big = 10000.0; 16 float small = 0.00001; 17 18 swap_values(&big, &small); 19 20 cout << "Big contains " << big << endl; 21 cout << "Small contains " << small << endl; 22 23 return 0; 24 }
[user02@FC4 Lesson11]$ g++ -o swapvals swapvals.cpp
[user02@FC4 Lesson11]$ ./swapvals
Big contains 1e-05
Small contains 10000
[user02@FC4 Lesson11]$
lesson_11_swapvals.cpp, Rev. 3, Last changed on 2006-01-06 11:33, 306 page hits
Musicload
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.344 seconds || || PAGERANK TOOLS