maybe it's turbo c that is wrong,not me

This is a discussion on maybe it's turbo c that is wrong,not me within the C Programming forums, part of the General Programming Boards category; i quite wonder why. Code: while (i<=4) {for(j=0;j<17;j++) {if(j==4+i||j==4-i||j==12+i||j==12-i) printf("*"); else printf(" "); } printf("\n"); i++; } this is a ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    5

    maybe it's turbo c that is wrong,not me

    i quite wonder why.
    Code:
     while (i<=4)
    	{for(j=0;j<17;j++)
    	    {if(j==4+i||j==4-i||j==12+i||j==12-i)
    		printf("*");
    	     else
    		printf(" ");
    	    }
    	  printf("\n");
    	 i++;
    	}
    this is a M made of *,well,i want several more of it,then i add outside the block a do-while function,like this,
    Code:
      m=0; 
        do{
             while (i<=4)
    	{for(j=0;j<17;j++)
    	        {if (j==4+i||j==4-i||j==12+i||j==12-i)
    		printf("*");
    	          else
    		printf(" ");
    	        }
    	    printf("\n");
    	        i++;
    	 }
              m++;
          }while(m<=100)
    it doesn't output anything but a move of cursoe.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Instead of pondering why Turbo C can't output a * where you need it, you might want to think about your programming logic, and why it won't put a * on the screen, where you need it.

    Go on and try it with another compiler - see if it works!

    Will it be Visual C's fault maybe, not week?

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    May-be you need to reset the variable i?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,193
    Quote Originally Posted by anon View Post
    May-be you need to reset the variable i?
    Exactly. Turbo C is not at fault here. One thing novices need to learn is to look for their own mistakes, rather than assuming it must be the compiler at fault.
    Right 98% of the time, and don't care about the other 3%.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Great case of: it's not my fault it's gotta be someone else's...

    Whatever I say: Maybe it's the English language that's wrong. Not me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Remember Turbo? It is comming back
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2006, 01:26 PM
  2. Cross Compiling with Linux and Turbo C
    By ozgulker in forum Linux Programming
    Replies: 0
    Last Post: 11-18-2002, 02:07 PM
  3. Where can I get a good old Turbo C compiler?
    By sundeeptuteja in forum C Programming
    Replies: 2
    Last Post: 09-15-2002, 07:40 AM
  4. What is Borland and Turbo
    By pratapgj in forum C Programming
    Replies: 1
    Last Post: 07-30-2002, 11:36 AM
  5. Turbo C Compiler
    By thomas in forum C Programming
    Replies: 2
    Last Post: 09-09-2001, 10:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21