Advertisement
Guest User

Untitled

a guest
Sep 17th, 2016
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Avant modifs :
  2.  
  3. /* ************************************************************************** */
  4. /*                                                                            */
  5. /*                                                        :::      ::::::::   */
  6. /*   colle00.c                                          :+:      :+:    :+:   */
  7. /*                                                    +:+ +:+         +:+     */
  8. /*   By: etieberg <marvin@42.fr>                    +#+  +:+       +#+        */
  9. /*                                                +#+#+#+#+#+   +#+           */
  10. /*   Created: 2016/09/03 10:18:16 by etieberg          #+#    #+#             */
  11. /*   Updated: 2016/09/04 20:56:48 by etieberg         ###   ########.fr       */
  12. /*                                                                            */
  13. /* ************************************************************************** */
  14.  
  15. void    ft_putchar(char c);
  16.  
  17. void    ft_putline(int x)
  18. {
  19.     int     i;
  20.     char    o;
  21.     char    dsh;
  22.     char    c_return;
  23.  
  24.     i = 2;
  25.     o = 'o';
  26.     dsh = '-';
  27.     c_return = '\n';
  28.     ft_putchar(o);
  29.     if (x > 1)
  30.     {
  31.         while (i < x)
  32.         {
  33.             ft_putchar(dsh);
  34.             i++;
  35.         }
  36.         ft_putchar(o);
  37.     }
  38.     ft_putchar(c_return);
  39. }
  40.  
  41. void    ft_puthole(int x)
  42. {
  43.     int     i;
  44.     char    pipe;
  45.     char    space;
  46.     char    c_return;
  47.  
  48.     i = 2;
  49.     pipe = '|';
  50.     space = ' ';
  51.     c_return = '\n';
  52.     if (x == 1)
  53.         ft_putchar(pipe);
  54.     if (x > 1)
  55.     {
  56.         ft_putchar(pipe);
  57.         while (i < x)
  58.         {
  59.             ft_putchar(space);
  60.             i++;
  61.         }
  62.         ft_putchar(pipe);
  63.     }
  64.     ft_putchar(c_return);
  65. }
  66.  
  67. void    colle(int x, int y)
  68. {
  69.     int i;
  70.  
  71.     i = 2;
  72.     if (x <= 0)
  73.         return ;
  74.     if (y == 1)
  75.         ft_putline(x);
  76.     if (y > 1)
  77.     {
  78.         ft_putline(x);
  79.         while (i < y)
  80.         {
  81.             ft_puthole(x);
  82.             i++;
  83.         }
  84.         ft_putline(x);
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement