Results 1 to 11 of 11

Thread: (C++)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jan:2009
    Location:
    Posts: 16

    (C++)

    , , integer- .

    :You have to write a program in C++ that computes the minimal and the maximal value of function f(x,y) obtained on an integer point in a given rectangle [a, b] x [c, d]. Your program should prompt the user to input numerical values of a, b, c and d, as floating point numbers, which are expected to be in a range from -100 thru 100. In case when minimal or maximal values do not exists, your program should output appropriate messages.

    , , loop-a ?

    ...



    #include <iostream>
    #include <cmath>
    using namespace std;

    int main()
    {
    double a,b,c,d,x,y,f;

    cout<<"Please, enter four numbers:"<<"\n";
    cout<<"a =";
    cin>>a;

    cout<<"b =";
    cin>>b;

    cout<<"c =";
    cin>>c;

    cout<<"d =";
    cin>>d;
    // if (a>100 || b>100 || c>100 || d>100 || a<-100 || b<-100 || c<-100 || d<-100)

    for ( x=a; x<=b; x=x+0.1)
    { for ( y=c; y<=d; y=y+0.1)
    {
    if (ceil (x)==x && ceil(y)==y)
    {cout<<"x is:"<<x<< " y is "<<y<<"\n";}

    }
    }
    system("pause");
    return 0;
    }

    !

  2. #2
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    loop-a , , ( ) 0.01, 0.1 .

  3. #3
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    int- . f() - "" , ?
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  4. #4
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    floating point:
    Your program should prompt the user to input numerical values of a, b, c and d, as floating point numbers

  5. #5
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    - floating point , int.
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  6. #6
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    Quote Originally Posted by anrieff View Post
    - floating point , int.
    ""? , , - . , , ? .

  7. #7
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    . . x y int, 1.

  8. #8
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    , , if- , floating point (delian ).
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  9. #9
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    - for ? .


    EDIT: , DEVCPP float.

  10. #10
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    , - , , . , - Fortran, Basic, Pascal . - http://en.wikipedia.org/wiki/For_loo...sion_for_loops
    Code:
     for(;;)
    ( ).

  11. #11
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    , ( Pascal ) for- - .
    C/C++, , , "" for.
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |