Results 1 to 4 of 4

Thread: Ascii Charset Generator in DOS

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    2


    Hi,
    This is my first post.I just started in this powerfull language.Here is what I learned,



    Code:
    //ASCII characterset generator
    void main(void)
    {
    int a,b,i,j;
    clrscr();
    printf("\nEnter the range to be generated (min:0 max:254)");
    abc:
    {
    printf("\nMin : ");scanf("%d",&i);
    printf("\Max : ");scanf("%d",&j);
    }
    if (i<0 || j >254)
    {
    printf("Out of Range!");
    goto abc;
    }
    for (a=i;a<=j;a++)
    {
    b=a;
    printf("\nCode %d : %c",b,b);
    }
    getch();
    }
    TC++ Compiler v3.0

  2. #2


    Your code shouldn&#39;t write "goto command". it&#39;s bad pattern and very very old writen.

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    2


    Fixed it!

    [code]/*ASCII characterset generator*/
    void main(void)
    {
    int a,b,i,j;
    clrscr();
    printf("\nEnter the range to be generated (min:0 max:254)");
    do
    {
    printf("\nMin : ");scanf("%d",&i);
    printf("Max : ");scanf("%d",&j);
    if

  4. #4
    Junior Member
    Join Date
    Apr 2009
    Posts
    14



    If you wanna be a good style programming , you must should&#39;t use "goto command".

    If your code have " goto command" , it&#39;s call " Spaghetti code ". It very hard for read. ^^

Similar Threads

  1. พิมพ์ ASCII ใน Dos
    By ole in forum ทิปหรือเคล็ดลับการคอมพิวเตอร์ต่างๆ
    Replies: 0
    Last Post: 08-07-2009, 08:31 PM
  2. Replies: 0
    Last Post: 09-01-2009, 12:11 AM
  3. Replies: 0
    Last Post: 19-10-2008, 07:02 AM
  4. MySQL Charset Truncation Vulnerability
    By newsbot in forum Exploits
    Replies: 0
    Last Post: 16-09-2008, 11:22 PM
  5. การแก้ปัญหา charset ของ mysql กับการอ่านภาษาไทยไม่ออก ????
    By praya in forum ทิปหรือเคล็ดลับการคอมพิวเตอร์ต่างๆ
    Replies: 1
    Last Post: 05-03-2008, 04:46 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •