Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #69469

Re: Program to print a pattern of hashtags: issues with spaces

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Program to print a pattern of hashtags: issues with spaces
Date 2015-09-05 14:56 +0100
Organization A noiseless patient Spider
Message-ID <87y4glhswa.fsf@bsb.me.uk> (permalink)
References <2ba87e0d-d563-4890-9e8f-a8a64916f266@googlegroups.com> <GIBFx.283710$nx.263775@fx16.am4> <77071dee-21c3-4bf6-aa71-714fc0652c2a@googlegroups.com> <KlTFx.420668$aP2.47872@fx38.am4> <02c42eee-cb4b-4110-bcf5-97499a64b3a8@googlegroups.com>

Show all headers | View raw


Alla _ <modelling.data@gmail.com> writes:

> Hello Everyone!
>
> Can't find enough thankful words for your 
> help! Although all of your contributions are
> valuable and helpful to me, I would like to thank 
> especially Richard, who has invested so much time
> and patience to help me with the material, and Ben. 
> I see my progress, and it is so amazing.

You're welcome.  It's nice when people say thank you but you don't need
to do it
>
> I still have to learn a lot about the basics we 
> have discussed in this and few other threads; 
> and I still have questions, some of which I will 
> post in the next reply.
>
> But first, please, let me brag a little bit :)
>
> Please, take a look at two options of a 
> bit revised (more complicated) version of 
> a program that should produce the following 
> output:
>
> '_' stand for spaces
>
> ___#__#___
> __##__##__
> _###__###_
> ####__####
>
> First version with functions (it was
> so exciting to learn them); second version
> with a for loop (I did two versions to 
> make sure I understand both of them, and to
> test myself).
<snip>
> void print_digraph_2 (int symbol_1, int symbol_2, int symbol_3, int symbol_4, int count)
> {
>     while(count--)
>     {
>         putchar (symbol_1);
>         putchar (symbol_2);
>         putchar (symbol_3);
>         putchar (symbol_4);
>     }
> }

You don't need this function at all.  You could just write:

> void print_line(int current_line, int height) 
>
> {
>     print_digraph_1 (' ', (height - current_line - 1));
>     print_digraph_1 ('#', current_line + 1);
>     print_digraph_1 (' ', 2);
>     print_digraph_1 ('#', current_line + 1);
>     print_digraph_1 (' ', (height - current_line - 1));
>     print_digraph_1 ('\n', 1);
> }

<snip>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-02 04:38 -0700
  Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-02 13:12 +0100
    Re: Program to print a pattern of hashtags: issues with spaces Gareth Owen <gwowen@gmail.com> - 2015-09-02 20:25 +0100
    Re: Program to print a pattern of hashtags: issues with spaces Keith Thompson <kst-u@mib.org> - 2015-09-02 15:50 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:07 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:08 -0700
    Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 00:26 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-03 09:16 +0100
        Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-05 04:35 -0700
          Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-05 13:08 +0100
            Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-05 05:48 -0700
          Re: Program to print a pattern of hashtags: issues with spaces Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-05 14:56 +0100
        Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-05 05:46 -0700
          Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-05 14:03 +0100
            Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-05 08:55 -0700
  Re: Program to print a pattern of hashtags: issues with spaces bartekltg <bartekltg@gmail.com> - 2015-09-02 14:39 +0200
  Re: Program to print a pattern of hashtags: issues with spaces Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-02 13:55 +0100
    Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 01:51 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-03 10:01 +0100
        Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:10 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-03 16:10 +0100
      Re: Program to print a pattern of hashtags: issues with spaces Keith Thompson <kst-u@mib.org> - 2015-09-03 09:12 -0700
  Re: Program to print a pattern of hashtags: issues with spaces Barry Schwarz <schwarzb@dqel.com> - 2015-09-02 11:52 -0700
    Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-02 20:24 +0100
      Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:06 -0700
        Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-03 10:36 +0100
          Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 03:10 -0700
      Re: Program to print a pattern of hashtags: issues with spaces Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-06 13:45 -0700
    Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:04 -0700
  Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 00:31 -0700
  Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 00:49 -0700
    Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-03 09:23 +0100
      Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 02:33 -0700
        Re: Program to print a pattern of hashtags: issues with spaces Richard Heathfield <rjh@cpax.org.uk> - 2015-09-03 10:39 +0100
          Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-03 03:11 -0700
  Re: Program to print a pattern of hashtags: issues with spaces Alla _ <modelling.data@gmail.com> - 2015-09-05 04:40 -0700

csiph-web