75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
|
#include <stdio.h>
|
|||
|
#include <math.h>
|
|||
|
#include <Windows.h>
|
|||
|
#include <locale.h>
|
|||
|
|
|||
|
#define PI 3.14159265358979323846
|
|||
|
|
|||
|
void vector_angle() {
|
|||
|
float x1, y1, x2, y2;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("x1 = ");
|
|||
|
scanf_s("%f", &x1);
|
|||
|
printf("y1 = ");
|
|||
|
scanf_s("%f", &y1);
|
|||
|
printf("x2 = ");
|
|||
|
scanf_s("%f", &x2);
|
|||
|
printf("y2 = ");
|
|||
|
scanf_s("%f", &y2);
|
|||
|
printf("%.2f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 57.3 * acos((x1 * x2 + y1 * y2) / (sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2))));
|
|||
|
}
|
|||
|
|
|||
|
void lc_freq() {
|
|||
|
float L, C;
|
|||
|
printf("L = ");
|
|||
|
scanf_s("%f", &L);
|
|||
|
printf("C = ");
|
|||
|
scanf_s("%f", &C);
|
|||
|
printf("%.2f <20><>", 1 / (2 * PI * sqrt(L * C)));
|
|||
|
}
|
|||
|
|
|||
|
void deposit() {
|
|||
|
int money, days;
|
|||
|
float rate, eff, result;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> %% = ");
|
|||
|
scanf_s("%f", &rate);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ");
|
|||
|
scanf_s("%d", &money);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> = ");
|
|||
|
scanf_s("%d", &days);
|
|||
|
result = money * pow((1 + (rate / 100) / days), days);
|
|||
|
eff = (result - money) / money * 100;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = %.2f%% <20><><EFBFBD><EFBFBD><EFBFBD> = %.2f", eff, result - money);
|
|||
|
}
|
|||
|
|
|||
|
int main() {
|
|||
|
//setlocale(LC_ALL, "Russian");
|
|||
|
SetConsoleCP(1251);
|
|||
|
SetConsoleOutputCP(1251);
|
|||
|
|
|||
|
int num;
|
|||
|
printf("1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
|||
|
printf("2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
|||
|
printf("3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>.\n");
|
|||
|
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%d", &num);
|
|||
|
|
|||
|
switch (num)
|
|||
|
{
|
|||
|
case 1:
|
|||
|
vector_angle();
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
lc_freq();
|
|||
|
break;
|
|||
|
case 3:
|
|||
|
deposit();
|
|||
|
break;
|
|||
|
default:
|
|||
|
printf("<EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>!");
|
|||
|
break;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|