Ejemplo n.º 1
0
/*START_OF_MAIN*/
int main()
{
    /*START_OF_VARIABLES*/
    int height,feet_height,point=1,length=1,length1=1,length2=1,result=0;
    char the_peak_point; 
    char the_road_point;
    /*END_OF_VARIABLES*/
    
    /*Kullanicidan cizim icin uzunluklari ve karakterleri alir*/
    printf("Enter the height for diagram:");
    scanf("%d",&height);
    printf("Enter the feet_height for diagram:");
    scanf("%d",&feet_height);
    printf("Enter the character for peak_point for diagram:");
    scanf("\n%c",&the_peak_point);
    printf("Enter the character for road_point for diagram:");
    scanf("\n%c",&the_road_point);
    /*point = draw_diag_step(height, feet_height, the_peak_point, the_road_point);*/
    length = (height * feet_height) + 1;
    /*Seklin tamamini cizen fonksiyon*/
    result = draw_ver_diag_of_bb(height,feet_height,the_peak_point,the_road_point);
    /*Grafigin taslagini cizen fonksiyon*/
    /*Burada istenilen islem 3 kere cagirilir.*/
    length = finish_diag(length);
    result = draw_ver_diag_of_bb(4,4,'x','-');
    length1 = (4 * 4) + 1;
    length1 = finish_diag(length1);
    result = draw_ver_diag_of_bb(2,4,'m','-');
    length2 = (2 * 4) + 1;
    length2 = finish_diag(length2);
    /*END_OF_MAIN*/
    return 0;
}
/*##########################################################################*/		
int draw_ver_diag_of_bb(int first_height, int feet_height,
						char the_peak_point, char the_road_point)
{
	int height2,counter=0;
	
	printf("^\n");
	
	/* grafigin adimlarinin azaltilarak tekrardan cagirilmasi */
	/* gelen return degerlerini toplayarak toplam karakter sayimizi buluruz*/
	for(height2=first_height;height2>=1;height2--)
	{
		counter = counter + draw_diag_step(height2,feet_height,
											the_peak_point,the_road_point);
	}
	/* grafigin x eksenini basarız */
	finish_diag(first_height*feet_height);
	return counter;
}
int
main (void)
{
    
    int first_height; /*Length of first hight*/
    int feet_height; /*Length of feet hight*/
    int length; /*The length of the diagram axis*/
    int total_ch; /*Total number of characters*/
    char the_peak_point; /*Peak point*/
    char the_road_point; /*Road point*/
    
    
/*############################FIRST TIME CALLING##############################*/    
    /*Input values*/ 
    printf("\n<<<<<<<<<For first ball>>>>>>>>>");
    printf("\nPlease enter the first_height of the ball: ");
    scanf("%d", &first_height);
    printf("Please enter the feet_height of the ball: ");
    scanf("%d", &feet_height);
    printf("Please enter the the_peak_point of the ball: ");
    scanf(" %c", &the_peak_point);
    printf("Please enter the the_road_point of the ball: "); 
    scanf(" %c", &the_road_point);
    
    /*Print the screen steps of bouncing ball and return total number of characters*/
    total_ch = draw_hor_diag_of_bb(first_height, feet_height, the_peak_point, the_road_point);
    
    /*The length of the diagram axis*/
    length = lenght_function(first_height);
    
    /*Print the screen diagram axis*/
    finish_diag(length);
    
    printf("\n\nTotal number of characters: %d\n\n", total_ch);
    
/*############################SECOND TIME CALLING#############################*/    
    /*Input values*/ 
    printf("\n<<<<<<<<<For second ball>>>>>>>>>");
    printf("\nPlease enter the first_height of the ball: ");
    scanf("%d", &first_height);
    printf("Please enter the feet_height of the ball: ");
    scanf("%d", &feet_height);
    printf("Please enter the the_peak_point of the ball: ");
    scanf(" %c", &the_peak_point);
    printf("Please enter the the_road_point of the ball: "); 
    scanf(" %c", &the_road_point);
    
    /*Print the screen steps of bouncing ball and return total number of characters*/
    total_ch = draw_hor_diag_of_bb(first_height, feet_height, the_peak_point, the_road_point);
    
    /*The length of the diagram axis*/
    length = lenght_function(first_height);
    
    /*Print the screen diagram axis*/
    finish_diag(length);
    
    printf("\n\nTotal number of characters: %d\n\n", total_ch);    
    
/*############################THIRD TIME CALLING##############################*/    
    /*Input values*/ 
    printf("\n<<<<<<<<<For third ball>>>>>>>>>");
    printf("\nPlease enter the first_height of the ball: ");
    scanf("%d", &first_height);
    printf("Please enter the feet_height of the ball: ");
    scanf("%d", &feet_height);
    printf("Please enter the the_peak_point of the ball: ");
    scanf(" %c", &the_peak_point);
    printf("Please enter the the_road_point of the ball: "); 
    scanf(" %c", &the_road_point);
    
    /*Print the screen steps of bouncing ball and return total number of characters*/
    total_ch = draw_hor_diag_of_bb(first_height, feet_height, the_peak_point, the_road_point);
    
    /*The length of the diagram axis*/
    length = lenght_function(first_height);
    
    /*Print the screen diagram axis*/
    finish_diag(length);
    
    printf("\n\nTotal number of characters: %d\n\n", total_ch);                    
    

    return 0;
    
}