Объяснение:
1
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin>>a>>b;
int p = (a + b) * 2;
int pl = a * b;
cout<<"Perimetr: "<<p;
cout<<"Ploshad: "<<pl;
}
2
int l;
float r, d;
cin>>l;
r = l / 2 / 3.14;
d = r * 2;
cout<<"Radius: "<<r;
cout<<"Diametr: "<<d;
3
void Reverse(char *numb)
char help;
int N = 3;
for (int i = 0; i < N / 2; i++)
help = numb[i];
numb[i] = numb[N - 1 - i];
numb[N - 1 - i] = help;
for (int i = 0; i < N; i++)
cout << numb[i];
int main(int argc, char const *argv[])
const int N = 3;
char numb[N];
cin >> numb;
Reverse(numb);
Как-то так, наверное
#include <cmath>
double a, x, b, c, D;
cout<<"Введите a: "; cin >> a;
cout<<"Введите b: "; cin >> b;
cout<<"Введите c: "; cin >> c;
D = pow(b,2)-4*a*c;
if(D>0){
cout << "x1 = " << ((-1)*b+sqrt(D))/(2*a)<<endl;
cout << "x2 = " <<((-1)*b-sqrt(D))/(2*a)<<endl;
else if(D==0){
cout << "x = " << ((-1)*b)/(2*a)<<endl;
else{
D*=(-1);
cout<< "x1 = " << ((-1)*b)/(2*a) <<"+"<< (sqrt(D))/(2*a) << "*i" <<endl;
cout<< "x2 = " << ((-1)*b)/(2*a) <<"-"<< (sqrt(D))/(2*a) << "*i" <<endl;
return 0;
Объяснение:
1
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin>>a>>b;
int p = (a + b) * 2;
int pl = a * b;
cout<<"Perimetr: "<<p;
cout<<"Ploshad: "<<pl;
}
2
#include <iostream>
using namespace std;
int main()
{
int l;
float r, d;
cin>>l;
r = l / 2 / 3.14;
d = r * 2;
cout<<"Radius: "<<r;
cout<<"Diametr: "<<d;
}
3
#include <iostream>
using namespace std;
void Reverse(char *numb)
{
char help;
int N = 3;
for (int i = 0; i < N / 2; i++)
{
help = numb[i];
numb[i] = numb[N - 1 - i];
numb[N - 1 - i] = help;
}
for (int i = 0; i < N; i++)
cout << numb[i];
}
int main(int argc, char const *argv[])
{
const int N = 3;
char numb[N];
cin >> numb;
Reverse(numb);
}
Как-то так, наверное
Объяснение:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, x, b, c, D;
cout<<"Введите a: "; cin >> a;
cout<<"Введите b: "; cin >> b;
cout<<"Введите c: "; cin >> c;
D = pow(b,2)-4*a*c;
if(D>0){
cout << "x1 = " << ((-1)*b+sqrt(D))/(2*a)<<endl;
cout << "x2 = " <<((-1)*b-sqrt(D))/(2*a)<<endl;
}
else if(D==0){
cout << "x = " << ((-1)*b)/(2*a)<<endl;
}
else{
D*=(-1);
cout<< "x1 = " << ((-1)*b)/(2*a) <<"+"<< (sqrt(D))/(2*a) << "*i" <<endl;
cout<< "x2 = " << ((-1)*b)/(2*a) <<"-"<< (sqrt(D))/(2*a) << "*i" <<endl;
}
return 0;
}