Most of these programs are programs I have written in school. I wrote them in Borland C++ Builder, great program by the way, if you don't want to use another Microsoft product :) However, some of them can still be compiled under languages with no changes to the code.
Do your friends think that Visual Basic is better than C++? Well, you can prove them wrong with just 7 lines of code! The following segment of code is often used to demonstrate recursive function calling. Recursive functions are supported in both C++ and VB... However, VB doesn't handle it nearly as well as C++. You can find out by compiling the code in both languages and sending different numbers to the fib(long) function. Anyway, heres the code (its the fibonacci sequence, don't know spelling):
#include "iostream.h" #include "conio.h" long fib(long n) { if (n == 0) return 1; else return fib(n-1) + fib(n-2); } int main() { cout << fib(100); getch(); return 0; }
Copyright (c) 2000 by Steve Berardi