Results 1 to 14 of 14
Thread: ++
Hybrid View
-
26th March 2010 20:11 #1Registered User
Join Date: Mar:2010
Location: Sofia
Posts: 73
++
. . ?
:
.
abs, labs, fabs
int, long, double, ceil, floor
,
sqrt pow
.
( <cstdlib>
<cmath>), .
#include<iostream.h>
#include<cstdlib>
#include<cmath>
using namespace std;
int main ()
{
int m=5, n=-7;
long k=5, l=-7;
double x=5.2, y=-7.7;
double a=-5.2, b=7.7;
cout<<"Absolute value functions"<<endl;
cout<<"|m|="<<abs(m)<< endl //cstdlib
<<"|n|="<<abs(n)<< endl;
cout<<"|k|="<<labs(k)<< endl //cstdlib
<<"|l|="<<labs(l)<< endl;
cout<<"|x|="<<fabs(x)<< endl //cmath
<<"|y|="<<fabs(y)<< endl<<endl;
cout<<"ceil function - round up <cmath>"<< endl;
cout<<"ceil(5.2) ="<<ceil(5.2)<< endl;
cout<<"ceil(-7.7)="<<ceil(-7.7)<< endl;
cout<<"ceil(-5.2)="<<ceil(-5.2)<< endl;
cout<<"ceil(7.7)="<<ceil(7.7)<< endl<<endl;
cout<<"floor function - round down <cmath>"<< endl;
cout<<"floor(5.2) ="<<floor(5.2)<< endl;
cout<<"floor(-7.7)="<<floor(-7.7)<< endl;
cout<<"floor(-5.2)="<<floor(-5.2)<< endl;
cout<<"floor(7.7)="<<floor(7.7)<< endl<<endl;
cout<<"sqrt function <cmath>" << endl;
cout<<"sqrt (16)= "<<sqrt(16) <<endl;
cout<<"sqrt (16.0)="<<sqrt (16.0) <<endl<<endl;
cout<<"pow function <cmath>" endl;
cout<<"pow(5.2,3)="<<pow(5.2,3)<< endl;
cout<<"pow(-5.2,3.0)="<<pow(-5.2,3.0)<< endl;
cout<<"pow(5.2,-3)="<<pow(5.2,-3)<< endl;
cout<<"pow(-5.2,-3.0)="<<pow(-5.2,-3.0)<< endl;
double z=pow(sqrt(4),2) + sqrt(pow(2,4))<< endl;
cout<<"z="<<z<< endl;
return 0;
}
6. C++, :
) a , a;
) , p.
. , ++ , a,b,c.(, )
-
26th March 2010 21:50 #2Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
6. . C++.
-
26th March 2010 22:35 #3
-
26th March 2010 23:08 #4
-> p = (sqrt(a))*4 ; ?
MSI X570-A PRO, AMD 5800X3D, Noctua NH-D15, Corsair Vengeance LPX 2x8GB-3600, ASUS RTX ROG 3080 Strix White OC, Samsung 980 Pro 1TB NVMe, Corsair RM750, FD Define R5, Dell 32" 4k G3223Q 144Hz + 3xSamsung G5 32" 144hz, SimLab P1-X, Simucube 2 Pro, HE Ultimate, SRB GT3 Wheel
-
26th March 2010 23:15 #5
-
26th March 2010 23:33 #6
-
27th March 2010 00:33 #7
-
27th March 2010 12:23 #8
-
27th March 2010 09:06 #9Registered User
Join Date: Mar:2010
Location: Sofia
Posts: 73
) p = (sqrt(a))*4, ) s=(sqr(p))/(12*sqrt(3)) S=(P/6)*sqrt(((p/3)^2)-((p/6)^2)) ?
-
27th March 2010 11:08 #10Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
C++ . .
-
27th March 2010 12:31 #11Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
- sqr , , sqrt. , "". , ( 3)/2,

, , , ( 3) - , .
- - . , , , " " ( 3) , .Last edited by bsb; 28th March 2010 at 11:15.
-
27th March 2010 13:15 #12
. . .
sqrt(((P/6)^3)*(P/2))
Last edited by haibusa2005; 27th March 2010 at 13:34.
-
27th March 2010 22:05 #13Registered User
Join Date: Mar:2010
Location: Sofia
Posts: 73
, ) )
-
27th March 2010 22:08 #14




Reply With Quote

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