.


:




:

































 

 

 

 





. ++, . Temperature.

. , SetDailyTemp , , Temperature .

Temperature SetDailyTemp(float reading[], int n)

{

// t 1- high low

Temperature t(reading[0], reading[0]);

// high low,

for (int i=1; i<n; i++)

t.UpdateTemp(reading[i]);

// t

return t;

}

reading . SetDailyTemp today. , GetHighTemp GetLowTemp.

float reading[6]={40,90,80,60,20,50};

Temperature today=SetDailyTemp(reading,6);

cout << " "

<< today.GetHighTemp() << ""

<< today.GetLowTemp() << endl;

 

. .

TemperatureRange (call by value) Temperature . Temperature ( ) .

float TemperatureRange(Temperature T)

{

return T.GetHighTemp()-.GetLowTemp();

}

Celsius (call by reference) Temperature, , , . Temperature, , .

void Celsius(Temperature& T)

{

float hi, low;

// = 5/9*(f-32)

hi = float(5)/9*(T.GetHighTemp() -32);

low = float(5)/9*(T.GetLowTemp() -32);

T = Temperature(hi, low);

}

: Water (212 ) (32 ) . TemperatureRange , 180 - . Celsius TemperatureRange, , 100 - ,

Temperature Water(212, 32);// 212F,

// 32F

cout <<" "

<< TemperatureRange(Water) << endl;

Celsius(Water); //

//

cout <<" "

<< TemperatureRange(Water) << endl;

, int char, . , . , . . Rectangle 100 Rectangle. , . 100 .

Rectangle pool(150,100);// 150100

Rectangle room[100]; //

//[0].. [99]

pool . room , Rectangle :

Rectangle(float 1=0, float w=0); //

room[i] :

cout << room[25].GetLengh() // 0;

cout << room[25].GetWidth() // 0;

room[25].PutLengh(10)// [25] 10

room[25].PutWidth(5)// [25] 5

Rectangle , . Rectangle , room , . , . , room 100 0 100 Rectangle. .

Rectangle room[100] = {Rectangle (0, 0),,.., Rectangle(0, 0)};

.

(default costructor) , . , . Rectangle , Temperature .

Rectangle

Rectangle (float l=0, float w=0);

l w 0. Rectangle .

Rectangle R[25];// Rectangle(0,0)

Temperature

Temperature(float h, float l);

Temperature . , . today week !

Temperature today; //:

Temperature week[7]; //Temperature





:


: 2016-12-07; !; : 264 |


:

:

,
==> ...

1654 - | 1529 -


© 2015-2024 lektsii.org - -

: 0.009 .