Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Work_7.h
- // Programing_Basics_Lab07
- //
- // Created by Sergiy on 20.02.17.
- #include <stdlib.h>
- #include <iostream>
- #include <math.h>
- double calculate_Y(double A, double B, double x)
- {
- double y;
- y = pow((A+B), 2) * sqrt((A+x)/(B+x)) * log((A+x));
- return y;
- }
- //-------------------------------
- // main.cpp
- // Programing_Basics_Lab07
- //
- // Created by Sergiy on 20.02.17.
- #include <iostream>
- #include <stdio.h>
- #include <math.h>
- #include "Work_7.h"
- #define A 5
- #define B 7
- int main(int argc, const char * argv[])
- {
- double x, y;
- printf("\nThe value of A is %d and the value of B is %d\n", A, B);
- printf("\nFor calculation (y = ((a+b) to the power of 2) х (sqrt from (a+x)/(b+x)) x ln(a+x)), enter the value of X (there is a logarithm in calculations, so the value of x have to be greater then -5):\n");
- scanf("%lf", &x);
- if (x <= -5)
- {
- printf("\nThere is a logarithm in calculations, so the value of x have to be greater then -5. Try again!\n");
- exit(1);
- }
- y = calculate_Y((double)A, (double)B, x);
- std::cout << "Table: Result of calculations\n";
- std::cout << "-------------------------------------------------------------\n";
- printf("| A = 5 | B = 7 | x = %-10.2lf | y = %20.2lf |\n", x, y);
- std::cout << "-------------------------------------------------------------\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement