#include <windows.h>
#include <stdio.h>
#include <math.h>
void gotoxy(int x, int y)
{
HANDLE hCon;
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hCon, dwPos);
}
int main()
{
gotoxy(20, 0); printf("EQUAZIONE DI SECONDO GADO\n");
//delta=b*b-4(a*c)
printf("\ndigita il valode di [a]=");
int valor_A;
scanf("%d", &valor_A);
printf("\ndigita il valore di [b]=");
int valor_B;
scanf("%d", &valor_B);
printf("\ndigita il valore di [c]=");
int valor_C;
scanf("%d", &valor_C);
for (int i = 0; i < 70; i++){
printf("_");
}
system("color f0");
gotoxy(0, 10); printf("%c N%c1 calcolare DELTA %c",16,248,127);
gotoxy(60, 25); printf("CALCOLANDO.....");
Sleep(4000);
system("cls");
system("color f0");
gotoxy(15,1); printf("a=%d\t\tb=%d\t\tc=%d",valor_A,valor_B,valor_C);
printf("\n");
int solucion1;
solucion1 = (valor_B*valor_B)- 4 * (valor_A*valor_C);
gotoxy(0, 3); printf("%cDELTA",16); gotoxy(10, 3); printf("%c=b%c-4(a * c)= %d", 127,253,solucion1);
printf("\n\n");
gotoxy(1, 3); printf("\n\n%cRadice quadra di %c=", 16, 127);
if (solucion1 <= 0)
{
printf("\n\nIMPOSIBILE\n");
printf("SOLO NUMERO INTERO!\n");
for (int i = 0; i < 70; i++){
printf("_");
}
printf("\n\n\n%c N%c2 CALCOLARE 'X' ",16, 248);
gotoxy(60, 25); printf("CALCOLANDO.....");
Sleep(9000);
system("cls");
system("color f0");
gotoxy(15, 0); printf("a=%d\t\tb=%d\t\tc=%d", valor_A, valor_B, valor_C);
printf("\n");
int solucion1;
solucion1 = (valor_B*valor_B) - 4 * (valor_A*valor_C);
gotoxy(0, 2); printf("\n%cDELTA=NUMERO NEGATICO", 16);
printf("\n\n");
for (int i = 0; i < 70; i++){
printf("_");
}
gotoxy(20, 6); printf("CALCOLO DI 'X'");
//X1,2=-b+-radice di delta/2*a
printf("\n\n\nFORMULA");
gotoxy(1, 10); printf("X=-b%c", 241);
gotoxy(3, 11); printf("%c%c%c%c", 238,238,238,238);
gotoxy(4, 12); printf("2*a");
int denominatore;
denominatore = 2 * valor_A;
gotoxy(1, 16); printf("X= -%d%c", valor_B, 241);
gotoxy(3, 17); printf("%c%c%c%c", 238, 238, 238, 238);
gotoxy(5, 18); printf("%d", denominatore);
int numeratore;
numeratore = -valor_B*-1;
gotoxy(20, 16); printf("X%c= %d ",251, numeratore);
gotoxy(23, 17); printf("%c%c%c", 238, 238, 238);
gotoxy(24, 18); printf("%d", denominatore);
int numeratore2;
numeratore2 = -valor_B*1;
gotoxy(40, 16); printf("X%c=%d", 253,numeratore2);
gotoxy(43, 17); printf("%c%c%c", 238, 238, 238);
gotoxy(44, 18); printf("%d", denominatore);
}
else {
int solucion2;
solucion2 = sqrt(float (solucion1));
printf("%d\n", solucion2);
for (int i = 0; i < 70; i++){
printf("_");
}
gotoxy(20, 7); printf("CALCOLO DI 'X'");
printf("\n\n\nFORMULA");
gotoxy(1, 12); printf("X=-b%c(sqrt)%c", 241,127);
gotoxy(3, 13); printf("%c%c%c%c%c%c%c%c%c%c", 238, 238, 238, 238,238,238,238,238,238,238);
gotoxy(6, 14); printf("2*a");
int denominatore;
denominatore = 2 * valor_A;
gotoxy(1, 20); printf("X= -%d%c%d", valor_B, 241,solucion2);
gotoxy(4, 21); printf("%c%c%c%c%c", 238, 238, 238, 238,238);
gotoxy(6, 22); printf("%d", denominatore);
int numeratore;
numeratore = -valor_B + solucion2;
gotoxy(20, 20); printf("X%c= %d ", 251, numeratore);
gotoxy(23, 21); printf("%c%c%c", 238, 238, 238);
gotoxy(24, 22); printf("%d", denominatore);
int numeratore2;
numeratore2 = -valor_B -solucion2;
gotoxy(40, 20); printf("X%c=%d", 253, numeratore2);
gotoxy(43, 21); printf("%c%c%c", 238, 238, 238);
gotoxy(44, 22); printf("%d", denominatore);
}
system("pause>registro");
return 0;
}
Nessun commento:
Posta un commento