# Lab_4_HalfDivision_While

Oct 31st, 2019
240
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #define _CRT_SECURE_NO_WARNINGS
2. #include <stdio.h>
3. #include <iostream>
4. //#include <Windows.h>
5.
6. int main() {
7. //setlocale(0, "1251");
8. //SetConsoleOutputCP(1251);
9.
10. float Xstart, Xfinish, x, y, h;
11. int i = 0;
12.
13. printf("Please, input left limit: ");
14. scanf("%f", &Xstart);
15. printf("Please, input right limit: ");
16. scanf("%f", &Xfinish);
18. scanf("%f", &h);
19.
20. if (Xstart > 9 || Xfinish < -5) {
21. puts("Function doesn't exist here");
22. }
23. else {
24. printf("\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCB\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB\n");
25. printf("\xBA x \xBA y \xBA\n");
26. x = Xstart;
27. while ( x <= Xfinish ) {
28. if (x <= 9 && x >= -5) {
29. if (x <= 0) {
30. if (x <= -3) {
31. y = x + 3;// [-5;-3]
32. }
33. else {
34. y = sqrt(9 - x * x);// (-3;0)
35. }
36. }
37. else {
38. if (x <= 6) {
39. y = -(x / 2) + 3;// (0;6]
40. }
41. else {
42. y = x - 6; // (6;9]
43. }
44. }
45. printf("\xBA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBA\n");
46. printf("\xBA%6.2f \xBA%6.2f \xBA\n", x, y);
47. }
48. else {
49. }
50. x += h;
51. }
52. printf("\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC\n");
53. }
54.
55. system("pause");
56. return 0;
57. }
RAW Paste Data