Показать сообщение отдельно

  #11  
Старый 25.01.2010, 20:10
cupper
Постоянный
Регистрация: 06.06.2007
Сообщений: 575
С нами: 9963746

Репутация: 180


По умолчанию

Цитата:
Сообщение от atomOK  
Помогите плиз переводчице сделать еще 5 лаб по с++

воть http://narod.ru/disk/17246678000/laba.doc.html

С 6ой уже помогли.

Если надо с меня качественный рерайт, перевод.
5-я:
Код:
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
	int x[20];
	int k=0;
	clrscr();
	randomize();
	for(int i=0;i<18;i++)
	{
		x[i]=(random(100) - random(100));
		printf("x[%2d]=%2d\n",i,x[i]); 
	}
	printf("-------");
	for(i=0;i<18;i++){
		if (x[i] < 0){
			printf("x[%2d] = %2d \n", i, x[i]);
			break;
		}
	}
	scanf("%d",&k);
}
4-я: (также с минимальными изменениями)
Код:
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<conio.h>
long factor(int k)
{long res;
if((k==1)||(k==0)) res=1;
else res=factor(k-1)*k;
return res;
}
float chlen(int m,float h)
{ float res;
//res=(m+2)*cos(m)/(factor(2*m+1)+pow(log(m*pow(h,2)),3));
res=pow(-1,m+1) * sqrt(m*pow(h,m)) / factor(m+1);
return res;
}
void main()
{clrscr();
float x=0.8,s=0,y=1,toch=1e-5;
int i=1;
while(fabs(y)>=toch)
{y=chlen(i,x);s+=y;
printf("%4d %10.8f %10.8f\n",i,y,s);
i++;}
printf("%f",s);
scanf("%f",&x);
}

Последний раз редактировалось cupper; 25.01.2010 в 20:22..
 
Ответить с цитированием