Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовая работа / Ktop
.cpp#include <conio.h>
#include <math.h>
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <stdio.h>
#include <dos.h>
double _max(double a, double b)
{
if (a>b) return a;
else return b;
}
double _maxt(double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8)
{
return 24/x4 + 2/x2*(x4+x4+x5+x7)+1/6*(x1+x2 );
}
int _s(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8)
{
return 2*x1+2*x2+2*x3+2*x4+x5+x6+x7+x8;
}
void main()
{
//clrscr();
int i, j, g, a, s, d, f, h, s0,lim;
int x1,x2,x3,x4,x5,x6,x7,x8;
double c, sq, min;
lim=25;
min=10000;
s0=99;
for (i=6;i<12;i++)
for (j=6;j<lim;j++)
for (g=6;g<lim;g++)
for (a=6;a<10;a++)
for (s=6;s<10;s++)
for (d=6;d<lim;d++)
for (f=6;f<12;f++)
for (h=6;h<10;h++)
{
sq=_s(i,j,g,a,s,d,f,h);
if (sq<=s0)
{
c=_maxt(i,j,g,a,s,d,f,h);
if (c<min)
{
min=c;
x1=i;x2=j;x3=g;x4=a;x5=s;x6=d;x7=f;x8=h;
}
}
}
printf("mint=%f\n",min);
printf("%d %d %d %d %d %d %d %d\n",x1,x2,x3,x4,x5,x6,x7,x8);
printf("Square=%d\n",_s(x1,x2,x3,x4,x5,x6,x7,x8));
/*cut>> a;
*/
p=getch();
// cout<<"fff";
for (h=1;h<10000000000000000000000;h++);
scanf("%d",&p);
}