Sep 22, 2011

This program will repeat the code input number of times specified by the user (calling method)

#include <iostream.h>
#include <conio.h>
void T(char ,int);
void main ()
{
char L;
int M;
L: cout << "\nEnter a character: ";
cin >> L;
cout << "Enter number of times to repeat it: " ;
cin >> M;
T(L,M);
goto L;
getch();
}
void T(char ch, int n)
{
for (int j = 0; j < n; j++)
cout << ch ;
cout << endl;
}




0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Premium Wordpress Themes