hi! can you tell me what is a recrusive function? and what it does? and there are some lines in this small program that i could not understand (followed by???????) can u plz explain me those lines? plz - //Program to implement a Recursive Function
-
#include <iostream.h>
-
#include <string.h>
-
#include <stdlib.h>
-
#include <conio.h>
-
void recurfunc(int start,int stop,char* buff);
-
void main()
-
{ clrscr();
-
cout << "enter how many times to loop: ";
-
char buff[100];
-
cin >> buff;
-
int num;
-
num = atoi(buff);//??????what atoi function does?
-
if(num >= 1)
-
{ recurfunc(0,num," this is a recursive function"); }
-
else { cout << "sorry you didnt enter valid data" << endl;
-
return; }
-
getch();
-
}
-
void recurfunc(int start,int stop,char* buff) */ what is the use of start &stop variable in the program????????? /*
-
{ if(start < stop)
-
{ start++;
-
cout << "\n" << buff << "\n";
-
recurfunc(start,stop,buff);
-
}
-
else
-
{ return; }
-
}
2 2072
hi! can you tell me what is a recrusive function? and what it does? and there are some lines in this small program that i could not understand (followed by???????) can u plz explain me those lines? plz
//Program to implement a Recursive Function
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
void recurfunc(int start,int stop,char* buff);
void main()
{ clrscr();
cout << "enter how many times to loop: ";
char buff[100];
cin >> buff;
int num;
num = atoi(buff);//??????what atoi function does?
if(num >= 1)
{ recurfunc(0,num," this is a recursive function"); }
else { cout << "sorry you didnt enter valid data" << endl;
return; }
getch();
}
void recurfunc(int start,int stop,char* buff) */ what is the use of start &stop variable in the program????????? /*
{ if(start < stop)
{ start++;
cout << "\n" << buff << "\n";
recurfunc(start,stop,buff);
}
else
{ return; }
}
A recursive function is a function that calls itself before completing.
atoi() takes character representation of a number, and returns it as an integer.
The function will stop calling itself when it has start is equal to stop.
This will tell you everything you need to know. And it is probably translated into your language if you use your local wikipedia wiki. Wikipedia Sign in to post your reply or Sign up for a free account.
Similar topics
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro...
|
by: David MacQuigg |
last post by:
I'm concerned that with all the focus on obj$func binding, &closures,
and other not-so-pretty details of Prothon, that we are missing what
is really good - the simplification of classes. There are...
|
by: Bengt Richter |
last post by:
ISTM that
@limited_expression_producing_function
@another
def func(): pass
is syntactic sugar for creating a hidden list of functions. (Using '|' in place of '@'
doesn't change the picture...
|
by: Brad Tilley |
last post by:
Is there an easier way to do this:
def print_whats_returned(function):
print function
print type(function)
|
by: Xah Lee |
last post by:
What are OOP's Jargons and Complexities
Xah Lee, 20050128
The Rise of Classes, Methods, Objects
In computer languages, often a function definition looks like this:
subroutine f (x1, x2, ...)...
|
by: Helge Jensen |
last post by:
I've got some data that has Set structure, that is membership, insert
and delete is fast (O(1), hashing). I can't find a System.Collections
interface that matches the operations naturally offered...
|
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic...
|
by: td0g03 |
last post by:
Hello, I am new to C and I am new to English. I not sure what palindromes mean. I don't know exactly what my teacher wants me to do. If someone could explain it to me in a different way that would be...
|
by: Viktor |
last post by:
Can somebody give me an explanation what happened here (or point me to
some docs)?
Code:
HMMM = None
def w(fn):
print 'fn:', id(fn)
HMMM = fn
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
| |