Close Back

      1  /*
      2  *	rajesh.h
      3  *
      4  *****************************************************************************
      5  *
      6  *	Miscellaneous functions in C
      7  *     	~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      8  *****************************************************************************
      9  *
     10  *     	Author           :  Rajesh _ThE gReAt
     11  *	Built on         :  Some day in 2k
     12  *	Last Modified on :  Friday, February 08, 2002, 3:54:00 PM
     13  *
     14  *	Known errors : none
     15  *
     16  *****************************************************************************
     17  *	DISCLAIMER:
     18  *****************************************************************************
     19  *
     20  *	Programmers may incorporate any or all code into their programs,
     21  *	giving proper credit within the source. Publication of the
     22  *	source routines is permitted so long as proper credit is given
     23  *	to Rajesh _ThE gReAt.
     24  *
     25  *	Copyright (C) 2002, 2003 by Rajesh _ThE gReAt.  You may use this program, or
     26  *	code or tables extracted from it, as desired without restriction.
     27  *	I can not and will not be held responsible for any damage caused from
     28  *	the use of this software.
     29  *
     30  *	Read license.txt from http://www.rajeshgoli.com/license.txt
     31  *	                   or http://www.rajeshgoli.com/license.htm
     32  *	before using / distributing / or any sort of use of my source
     33  *	Also read my disclaimer http://www.rajeshgoli.com/disclaimer.htm
     34  *	
     35  *	YOU AGREE TO BE BOUND BY MY DISCLAIMER AND LICENSE BY IN ANY WAY
     36  *	USING THIS FILE .
     37  *
     38  *****************************************************************************
     39  * This source works with Turbo C 2.0 and Turbo C++ 3.0 and above.
     40  *****************************************************************************
     41  *	Rajesh _ThE gReAt is a synonym of Rajesh Goli
     42  *	Source freely distributable 
     43  *****************************************************************************/
     44  
     45  #ifndef __STDIO_H
     46  #include<stdio.h>
     47  #endif
     48  
     49  /* for clrscr() */
     50  #ifndef __CONIO_H
     51  #include<conio.h>
     52  #endif
     53  
     54  /* for delay() */
     55  #ifndef __DOS_H
     56  #include<dos.h>
     57  #endif
     58  
     59  void	print_rajesh	(void);
     60  void	rotate		(int );
     61  int	repeat		(void);
     62  
     63  /* Prints my name and essentially calls rotate
     64  */
     65  void print_rajesh(void)
     66  {
     67  	clrscr();
     68  	printf("\nThis program made by :");
     69  	printf("\n\n\n\n\n\007");
     70  	printf(",##########.                   ,####.                          ,####.\n");
     71  	printf(":#############.                `####;                          :####.\n");
     72  	printf(":#####. :#####.                                                :####.\n");
     73  	printf(":#############;   `#########.  ,####.  ,#######.    ,########. :###########.\n");
     74  	printf(":############;          :####. :####. ,###. :###.  ,####.  :#. :###########.\n");
     75  	printf(":##########.       :#########. :####.,####. :####.`##########. :####. :####.\n");
     76  	printf(":###########.   ,############. :####.:###########;  `#########.:####. :####.\n");
     77  	printf(":############.  :#####. :####. :####.`#####.            :#####;:####. :####.\n");
     78  	printf(":#####. `######  ############. :####. `#########.  ,#########; :####. :####.\n");
     79  	printf("`#####;  `######; `##########; :####.     `#####;  `#######;   `####; `####;\n");
     80  	printf("                              #####");
     81  	printf("\n\n\n\tRajesh _ThE gReAt in 2k + 2.....\n\n\n\t\t\tHit any key to continue.....");
     82  		for(;!kbhit();)
     83  		{
     84  			printf("\b");
     85  			delay(150);
     86  			printf("\b|");
     87  			delay(150);
     88  			printf("\b/");
     89  			delay(150);
     90  			printf("\b-");
     91  			delay(150);
     92  		}
     93  	printf("\b ");
     94  }
     95  
     96  /* Rotate illusion using '-' '\' '|' '/'
     97     num = delay in milliseconds b/w each move
     98  */
     99  void rotate(int num)
    100  {
    101  	for(;!kbhit();)
    102  	{
    103  		printf("\b");
    104  		delay(num);
    105  		printf("\b|");
    106  		delay(num);
    107  		printf("\b/");
    108  		delay(num);
    109  		printf("\b-");
    110  		delay(num);
    111  	}
    112  	printf("\b ");
    113  }
    114  
    115  /* Displays [yn]
    116     and gets option
    117  */
    118  int repeat(void)
    119  {
    120  	char resp[3];
    121  	printf("[yn] : ");
    122  	gets(resp);
    123  	if(resp[0] == 'y' || resp[0] == 'Y')
    124  		return 1;
    125  	else
    126  		return 0;
    127  }