Язык С++ Прога Dev++
Вычислить y=a*min(x,y,z)-b,где x,y,z,a,b-вводятся,причем a,b должны быть кратны 5,иначе выдать соответствующее сообщение
Вот как я написал
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
int y,x,z,b,a;
cin>>x>>endl;
cin>>y>>endl;
cin>>z>>endl;
cin>>b>>endl;
cin>>a>>endl;
if ((a%5==0)&&(b%5==0))
if ((x<y)&&(y<z))
y=a*x-b cout<<y<<endl;
if ((y<x)&&(y<z))
y=a*y-b cout<<y<<endl;
if ((z<x)&&(x<q))
y=a*z-b cout<<y<<endl;
else cout<<"a,b ne kratnu 5";
getch();
return 0;
}
Ответы
Ответ дал:
0
/*некритично, но у тебя нет диалога с пользователем. неплохо бы предложить ему ввести данные. в коде нет пояснений.
......*/
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
int b,a, x,y,z;
cout<<"insert a"; cin>>a>>endl;
cout<<"insert b"; cin>>b>>endl;
cout<<"insert x"; cin>>x>>endl;
//а что такое x, y, и z - вообще непонятно. И откуда q появилась? ты ее не
//объявлял.
if ((a%5==0)&&(b%5==0));
{
if ((x<y)&&(y<z))
{y=a*x-b; cout<<"y="<<y<<endl; }
if ((y<x)&&(y<z))
{y=a*y-b; cout<<"y="<<y<<endl; }
}
else cout<<"a i b ne kratny 5";
getch();
return 0;
}
......*/
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
int b,a, x,y,z;
cout<<"insert a"; cin>>a>>endl;
cout<<"insert b"; cin>>b>>endl;
cout<<"insert x"; cin>>x>>endl;
//а что такое x, y, и z - вообще непонятно. И откуда q появилась? ты ее не
//объявлял.
if ((a%5==0)&&(b%5==0));
{
if ((x<y)&&(y<z))
{y=a*x-b; cout<<"y="<<y<<endl; }
if ((y<x)&&(y<z))
{y=a*y-b; cout<<"y="<<y<<endl; }
}
else cout<<"a i b ne kratny 5";
getch();
return 0;
}
Ответ дал:
0
вместо q должна быть y
Ответ дал:
0
выражение выглядит y=a*min(x,y,z)-b
Вас заинтересует
2 года назад
2 года назад
10 лет назад
10 лет назад
10 лет назад