Results 1 to 11 of 11
Thread: (C++)
Hybrid View
-
19th January 2011 00:09 #1Registered 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;
}
!
-
20th January 2011 09:10 #2
-
20th January 2011 09:39 #3
int- . f() - "" , ?
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
20th January 2011 10:24 #4
floating point:
Your program should prompt the user to input numerical values of a, b, c and d, as floating point numbers
-
20th January 2011 10:38 #5
- floating point , int.
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
20th January 2011 12:48 #6Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
-
20th January 2011 10:46 #7
-
20th January 2011 13:48 #8
, , if- , floating point (delian ).
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
20th January 2011 15:06 #9
-
20th January 2011 15:10 #10Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
, - , , . , - Fortran, Basic, Pascal . - http://en.wikipedia.org/wiki/For_loo...sion_for_loops
( ).Code:for(;;)
-
20th January 2011 15:40 #11, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in