#include <bits/stdc++.h>
using namespace std;
int main() {
char a,b,r,p,s;
cin>>a>>b;
if(a==p and b==p){
cout<<p;
}else if(a==r and b==r){
cout<<r;
}else if(a==s and b==s){
cout<<s;
}else if(a==p and b==r){
cout<<s;
}else if(a==r and b==p){
cout<<s;
}else if(a==s and b==r){
cout<<p;
}else if(a==r and b==s){
cout<<p;
}else if(a==p and b==s){
cout<<r;
}else if(a==s and b==p){
cout<<r;
}
return 0;
}
Объяснение:
у меня там ошибка, не могу понять из за чего
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
using namespace std;
double area, circumference;
void circle(double);
int main() {
locale::global(locale(""));
cout << " Введите радиус: ";
double radius;
cin >> radius;
circle(radius);
streamsize accuracy = 8;
cout << " Длина окружности: " << setprecision(accuracy) << fixed << circumference << endl
<< " Площадь круга: " << area << endl;
cin.get(); cin.get();
return 0;
}
void circle(double _radius) {
circumference = 2 * M_PI * _radius;
area = M_PI * _radius * _radius;
}
Вроде бы так, если я тебе дай лучший ответ =) [с новым годом]
var a = -2;
var b = 2;
var c = 3;
var mas = [a, b, c]; //или mas.push(a); mas.push(b); mas.push(c);
for(var i = 0; i < mas.length; i++)
{
if(mas[i] < 0)
{
Math.pow(mas[i], 2); //или mas[i]*mas[i];
//Вывод квадратов отрицательных чисел
}
else if(mas[i] > 0)
{
Math.pow(mas[i], 3); //или mas[i]*mas[i]*mas[i];
//Вывод кубов положительных чисел
}
}
Объяснение:
Массив использован для удобства, универсальности и компактности кода.