Page 6 of 9 FirstFirst ... 345678 ... LastLast
Results 51 to 60 of 82
  1. #51

    Quote Originally Posted by xiao_xiao View Post
    revised...
    getch() na akong gamit, dili na getche... tapos case insensitive na.
    PHP Code:
    #include<stdio.h>
    #include<conio.h>
    int add(intint);
    int subtract(intint);
    float divide(intint);
    int multiply(intint);

    int main()
    {
     
    int abdef;
     
    float g;
     
    char c;
     
     
    printf("Enter two integers separated by a space: ");
     
    scanf("%d %d", &a, &b);

     
    printf("Select an operation:\n(a) Add\n(s) Subtract\n(d) Divide\n(m) Multiply\n");
     
    printf("Choice: ");
     
    scanf("%c",&c);

     
    getch();

     if (
    c=='a' || c=='A')
     {
      
    d=add(ab);
      
    printf("\nThe sum of %d and %d is %d\n"abd);  
     }

     if (
    c=='s' || c=='S')
     {
      
    e=subtract(ab);
      
    printf("\nThe difference of %d and %d is %d\n"abe);  
     }

     if (
    c=='d' || c=='D')
     {
      
    g=divide(ab);
      
    printf("\nThe quotient of %d and %d is %.2f\n"abg);  
     }

     if (
    c=='m' || c=='M')
     {
      
    f=multiply(ab);
      
    printf("\nThe product of %d and %d is %d\n"abf);  
     }

     
    getch();
     return 
    0;
    }


    int add(int aint b)
    {
     return (
    a+b);
    }
    int subtract(int aint b)
    {
     return (
    a-b);
    }
    int multiply(int aint b)
    {
     return (
    a*b);
    }
    float divide(int aint b)
    {
     return ((float)
    a/b);

    Working ni bro pero di lang siya muprint sa letter of choice...

  2. #52
    sad to say... c = getche(); jud imo gamiton. hehe

  3. #53
    marc nag gamit namo ug else if? kay basin pud mahibung teacher nimo aning operation

    if (c=='a' || c=='A')

    so try nako balik na sa 2nd ang input of integers and using void.

    testing...............

    mao gihapon ma drop ang program inig input sa choice of operation, you can still modify the program with void main(void).

    Naa man to explanation ani ngano dili pwedi e una, kalimot lang ko when I was 1st yr college pa sa CIT.

  4. #54
    I've got a solution kung gusto jud ka ug c = getch();

    PHP Code:
    #include<stdio.h>
    #include<conio.h>
    int add(intint);
    int subtract(intint);
    float divide(intint);
    int multiply(intint);

    int main()
    {
     
    int abdef;
     
    float g;
     
    char c;
     
     
    printf("Enter two integers separated by a space: ");
     
    scanf("%d %d", &a, &b);

     
    printf("Select an operation:\n(A) Add\n(S) Subtract\n(D) Divide\n(M) Multiply\n");
     
    printf("Choice: ");
     
    scanf("%c",&c);

     
    getch();

     if (
    c=='a' || c=='A')
     {
      
    d=add(ab);
      
    printf("%c\nThe sum of %d and %d is %d\n"cabd);  
     }

     if (
    c=='s' || c=='S')
     {
      
    e=subtract(ab);
      
    printf("%c\nThe difference of %d and %d is %d\n"cabe);  
     }

     if (
    c=='d' || c=='D')
     {
      
    g=divide(ab);
      
    printf("%c\nThe quotient of %d and %d is %.2f\n"cabg);  
     }

     if (
    c=='m' || c=='M')
     {
      
    f=multiply(ab);
      
    printf("%c\nThe product of %d and %d is %d\n"cabf);  
     }

     
    getch();
     return 
    0;
    }


    int add(int aint b)
    {
     return (
    a+b);
    }
    int subtract(int aint b)
    {
     return (
    a-b);
    }
    int multiply(int aint b)
    {
     return (
    a*b);
    }
    float divide(int aint b)
    {
     return ((float)
    a/b);

    notice the changes...
    PHP Code:
    printf("%c\nThe sum of %d and %d is %d\n"cabd); 
    printf("%c\nThe sum of %d and %d is %d\n", c, a, b, d);

  5. #55
    Quote Originally Posted by SmaRkieS View Post
    Naa man to explanation ani ngano dili pwedi e una, kalimot lang ko when I was 1st yr college pa sa CIT.
    Lage bro, gi try man pud toh nako ang imong program nga mag una ang integers. Mu exit lage gihapon inig butang sa choice of operations. T_T Muwork lang jud siya if maguna ang choice of operation.

    Well, maybe dili jud nato masunod ang sample run nga gihatag sa among maestra pero at least, nakuha nato ang expected outcome using simple codes.

    Ay, wala pa diay mi nag discuss sa else if. IF ra jud iyang gusto makit-an.

  6. #56
    Quote Originally Posted by xiao_xiao View Post
    I've got a solution kung gusto jud ka ug c = getch();
    PHP Code:
    printf("%c\nThe sum of %d and %d is %d\n"cabd); 
    printf("%c\nThe sum of %d and %d is %d\n", c, a, b, d);
    Ngano naa may %c after sa open quotations? Unsa man effect ani using getch();?

  7. #57
    kung c = getch(); imong gamiton kay dili mn mugawas ang letter of choice...
    so ang solution kay isagol na lng nimo sa output.

    otherwise kung dili ka ganahan ani printf("%c\nThe sum of %d and %d is %d\n", c, a, b, d);
    balik ka sa c = getche() tapos balik pud ka to printf(\nThe sum of %d and %d is %d\n", a, b, d);

  8. #58
    marc, based on my experience sa una some teachers malipay or gahana nga mag una ang studyante (feeling expert) just to prove them nag self study ka, aw noon sa una nag self study dyud ko most of my vacant time naa sa library (nag baha ang mga books sa CIT) extra time mag practice, extra time mag babewatch, extra time mag tulog tulog.

    Pero sunda lang sa ang instructions sa imong teacher ang flow sa inyong discussion ba basin ma shock imong teacher where ka anang mga codes nga wala pa ma discuss.

    If linya dyud nimo ang computer then interesado dyud ka ug programming, ask your teacher if pwedi ba mag self study. Para kung mag discuss, most of the time mo ask man dyud na ang teacher to volunter to solve a program to the black board without any aid of computer, maka impress dyud baya.

    May unta gi sabay ang inyong flow charting and programming, kay gamit dyud kaayo na ang duha.

    May gani na save pa nako akong mga projects, activities and, exam programs.

  9. #59
    marc, trust me. ok ra ng mag-gamit ug getche() ui. over na sad na inyong teacher kung dili mo pagamiton ana. hehe. peace.
    gipagamit mn gani mo ug getch().. igsoon ra ng ng getch() ug getche(). hehe
    getch() = get character.
    getche = get character ewan. haha

    basta ang getche() kay i-print niya imong gi-press na keyboard character.

  10. #60
    getch() - get character without echo
    getche() - get character with echo

  11.    Advertisement

Page 6 of 9 FirstFirst ... 345678 ... LastLast

Similar Threads

 
  1. Help me in my laptop problem
    By Wenxp7 in forum Computer Hardware
    Replies: 16
    Last Post: 10-08-2010, 07:48 PM
  2. pls help me in my pldt dsl connection...
    By glenntacan in forum Networking & Internet
    Replies: 5
    Last Post: 01-23-2009, 05:15 PM
  3. help me in my front panel config
    By absimon in forum Computer Hardware
    Replies: 5
    Last Post: 12-05-2008, 07:18 PM
  4. Please help me in martial arts.
    By Chalil in forum Sports & Recreation
    Replies: 11
    Last Post: 09-20-2006, 10:52 PM
  5. Where can I repair my flash drive?!!! Help me!!!
    By jonmlas in forum Gizmos & Gadgets (Old)
    Replies: 13
    Last Post: 11-30-2005, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top