Mail Archives: djgpp/1998/04/20/01:01:39
From: | "Johhny" <zieglmeier AT nisa DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Base Case???
|
Date: | 20 Apr 98 04:03:39 GMT
|
Organization: | Okanagan Internet Junction
|
Lines: | 19
|
Message-ID: | <01bd6c12$a98c5780$69d8c2cf@zieglmeier>
|
NNTP-Posting-Host: | news.nisa.net
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Im a beginner Programmer wondering if anyone knows what the base case is in
this recusive function:
#include <iostream.h>
int numActs=0;
void PrintStars(int n) //recursive funcion
{ numActs++;
if(n>=1)
{ for(int i=1;i<=n;i++)
cout<<"*";
cout<<endl;
PrintStars(n/2);
}
}
void main()
{ PrintStars(8);
cout<<"Total number of activations is "
<<numActs<<endl;
}
- Raw text -