Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: C# HELP - Factors of a number.  (Read 17739 times)

0 Members and 1 Guest are viewing this topic.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: C# HELP - Factors of a number.
« Reply #15 on: February 27, 2009, 11:57:05 AM »
Quote
do not hijack somebody elses

And BC,  you never do that?

er... That's different, I "ease" the thread innocently in a different direction.  ;D

And I usually have accomplices.
I was trying to dereference Null Pointers before it was cool.

Jesz31



    Starter

    Re: C# HELP - Factors of a number.
    « Reply #16 on: March 13, 2009, 07:05:10 PM »
    hello guyz... i need your help??? what is wrong in this program>>>
    when I press N it will go to choice but I can't input any letters because it will terminate
    help.. me plz....

    #include<stdio.h>
    #include<conio.h>
    main()
    {
    int a,d,c,s,h,ls,car,scifi,ans;
    char ch;
    #define p printf
    #define g gotoxy
    #define c cprintf
    choice:
    {clrscr();
    g(17,2);p(" >>()> JESSAR_AMA VIDEO RENTALS <()<< ");
    g(25,3);p("CONTACT No.09092957632");
    g(15,7);p("PRESS[");textcolor(WHITE+BLINK);c("A");p("]for ACTION:");
    g(15,9);p("PRESS[");textcolor(WHITE+BLINK);c("D");p("]for DRAMA:");
    g(15,11);p("PRESS[");textcolor(WHITE+BLINK);c("C");p("]for COMEDY");
    g(15,13);p("PRESS[");textcolor(WHITE+BLINK);c("S");p("] for SUSPENSE:");
    g(15,15);p("PRESS [");textcolor(WHITE+BLINK);c("L");p("] for LOVE STORY:");
    g(15,17);p("PRESS [");textcolor(WHITE+BLINK);c("H");p("] for HORROR:");
    g(15,19);p("PRESS [");textcolor(WHITE+BLINK);c("F");p("] for  FICTION\n");
    p("\n              Enter your choice:_");gotoxy(33,21);
    scanf("%c",& ch);}
    switch(ch)
    {
    case 'A': clrscr();
    g(29,1);textcolor(BLUE+BLINK);c("***************");
    g(29,3);textcolor(BLUE+BLINK);c("***************");
    g(43,2);textcolor(BLUE+BLINK);c("*");
    g(29,2);textcolor(BLUE+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("ACTION MOVIES");
    g(30,5);p("Are you sure?[Y/N]");
    scanf("%s",&ans);
    if (ans=='N')
    {
    goto choice;
    }
    break;

    case 'D': clrscr();
    g(29,1);textcolor(RED+BLINK);c("**************");
    g(29,3);textcolor(RED+BLINK);c("**************");
    g(42,2);textcolor(RED+BLINK);c("*");
    g(29,2);textcolor(RED+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("DRAMA MOVIES");break;

    case 'C': clrscr();
    g(29,1);textcolor(YELLOW+BLINK);c("***************");
    g(29,3);textcolor(YELLOW+BLINK);c("***************");
    g(43,2);textcolor(YELLOW+BLINK);c("*");
    g(29,2);textcolor(YELLOW+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("COMEDY MOVIES");break;

    case 'S': clrscr();
    g(29,1);textcolor(GREEN+BLINK);c("******************");
    g(29,3);textcolor(GREEN+BLINK);c("******************");
    g(45,2);textcolor(GREEN+BLINK);c("*");
    g(29,2);textcolor(GREEN+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("SUSPENSE MOVIES");break;

    case'L':clrscr();
    g(29,1);textcolor(RED+BLINK);c("*******************");
    g(29,3);textcolor(RED+BLINK);c("*******************");
    g(47,2);textcolor(RED+BLINK);c("*");
    g(29,2);textcolor(RED+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("LOVE STORY MOVIES");break;

    case 'H': clrscr();
    g(29,1);textcolor(YELLOW+BLINK);c("***************");
    g(29,3);textcolor(YELLOW+BLINK);c("***************");
    g(43,2);textcolor(YELLOW+BLINK);c("*");
    g(29,2);textcolor(YELLOW+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("HORROR MOVIES");break;

    case 'F': clrscr();
    g(29,1);textcolor(GREEN+BLINK);c("****************");
    g(29,3);textcolor(GREEN+BLINK);c("****************");
    g(44,2);textcolor(GREEN+BLINK);c("*");
    g(29,2);textcolor(GREEN+BLINK);c("*");
    g(30,2);textcolor(WHITE);c("FICTION MOVIES");break;

    default:gotoxy(17,40);textcolor(RED+BLINK);cprintf("             SORRY THE MOVIE TYPE YOU WANT IS NOT AVAILABLE!!!");
    }

    getch();}

    

    ultimatum

      Topic Starter


      Intermediate
    • Thanked: 3
      Re: C# HELP - Factors of a number.
      « Reply #17 on: March 14, 2009, 01:39:14 PM »
      I'm not sure what language this is, but why are you entering 'N', the menu should initiate right away and be waiting for your input.

      Why do you have this line "int a,d,c,s,h,ls,car,scifi,ans;"? Why are these letters type of int? or is that a continuation of the program?
      Its not what you know, its what you can do that counts!

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: C# HELP - Factors of a number.
      « Reply #18 on: March 27, 2009, 09:12:38 PM »
      If you want other people to help you, try to avoid this sort of thing:
      Code: [Select]
      #define p printf
      #define g gotoxy
      #define c cprintf

      If makes things hard to read and you can make a very bad error.

      Aldo, it helps if you use a High-Level approach for something that is not going to be used to launch rockets .
      Make a case block as clean and neat as you can. avoid details.
      Something like this:

      Code: [Select]
      case 'A' : dofirst;(); break;
      case 'D' : dosecond();  break;
      case 'E' : dothird(); break ;
      case 'N' : goto choice;

      Using inline code makes it hard to debug. Start out with void functions  that are 'stubs', they don't do anything, but they are place holders where you will expand the code later as you work out the logic flaws. The concept is to HIDE details the are not relevant to the logic of what you are doing.
      This way you separate the logic from the decoration.