Dear all
This program takes from you a alphabetic character and shows all of characters before it .(ascending or descending)
I wrote it by Borland 5.02 .
DO JOY!!!!
Dear all
This program takes from you a alphabetic character and shows all of characters before it .(ascending or descending)
I wrote it by Borland 5.02 .
DO JOY!!!!
//recursive showing of alphabetic characters
//programming by : Erfan Nasoori
//Emaile : ketn68@yahoo.com
//Date of send : 2009/1/13
#include <iostream.h>
#include <conio.h>
void f(char);
void main()
{
char c;
cout<<"Enter alphabetic character : ";
cin>>c;
while( (c<'a' || c>'z') && (c<'A' || c>'Z') )
{
cout<<"Please enter alphabetic character : ";
cin>>c;
}
f(c);
getch();
}
/*void f(char c) //if you active this one
{ //characters will be shown inversely
cout<<c<<' ';
if(c=='a' || c=='A')
return;
else
f(c-1);
}*/
void f(char c)
{
if(c=='a' || c=='A')
cout<<c<<' ';
else
{
f(c-1);
cout<<c<<' ';
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.