29.09.2012, 18:59. Просмотров 507. Ответов 3
Элементарный математический код, но почему то всегда равно 0,0000. Тут я еще использую старые функции ввода-вывода, потому что так надо на лабораторную. Вот код:
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| #include<iostream>
#include<stdio.h>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
float a;
float b;
float c;
float d;
float z;
float x;
do
{
puts("Input variables a,b,c,d");
scanf("%f",&a);
scanf("%f",&b);
scanf("%f",&c);
scanf("%f",&d);
z=sin(c)*abs(b+d);
if(z==1)
puts("Error! Division by zero. Please, input variables once again");
}
while(z==1);
x=(a*sin(b)+b*cos(a))/(1-z);
printf("(a*sin(b)+b*cos(a))/(1-sin(c)*|b+d|)=");
printf("%f",&x);
system("pause");
return 0;
} |
|