Created
October 15, 2012 18:31
-
-
Save Yegorov/3894196 to your computer and use it in GitHub Desktop.
Geometry Lab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <locale.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <math.h> | |
#include <windows.h> | |
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
main(void) { | |
setlocale(LC_ALL,"Russian"); //установка русского языка | |
// Объявление переменных | |
int i; | |
float t[4][2]; // Массив координат | |
float xa, ya, xb, yb, xc, yc, xd, yd; // Координаты точек | |
float a, b, c, d, d1, d2; // Длина сторон четырехугольника | |
float qwe; // рабочая переменная | |
printf("Лабораторная работа №1. Решения задач аналитической геометрии"); | |
Sleep(3500); | |
printf("\n\n\nПроверка точек на существования ромба"); | |
Sleep(1500); | |
printf("\n\n\nНе вводите никакие символы, кроме цифр и ,"); | |
Sleep(2500); | |
Start: printf("\n\n\nВведите:"); | |
//ввод данных | |
for(i=0; i<=3; i++) | |
{ | |
printf("\nКоординаты: %d-ой точки: \n \n \t \t x=", i+1); // ,i+1 | |
scanf("%f", &qwe); | |
t[i][0]=qwe; | |
printf("\n \t \t y="); | |
scanf("%f", &qwe); | |
t[i][1]=qwe; | |
} | |
xa=t[0][0]; | |
ya=t[0][1]; | |
xb=t[1][0]; | |
yb=t[1][1]; | |
xc=t[2][0]; | |
yc=t[2][1]; | |
xd=t[3][0]; | |
yd=t[3][1]; | |
a=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); | |
b=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)); | |
c=sqrt((xc-xd)*(xc-xd)+(yc-yd)*(yc-yd)); | |
d=sqrt((xd-xa)*(xd-xa)+(yd-ya)*(yd-ya)); | |
d1=sqrt((xd-xb)*(xd-xb)+(yd-yb)*(yd-yb)); | |
d2=sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)); | |
/*a=sqrt( (pow(xa-xb),2)+(pow(ya-yb),2) ); | |
b=sqrt((pow(xb-xc),2)+(pow(yb-yc),2)); | |
c=sqrt((pow(xc-xd),2)+(pow(yc-yd),2)); | |
d=sqrt((pow(xd-xa),2)+(pow(yd-ya),2)); */ | |
if (a>0 && b>0 && c>0 && d>0) { | |
if (a+b>d2 && a+d2>b && b+d2>a && | |
d+c>d2 && d2+d>c && c+d2>d && | |
a+d>d1 && a+d1>d && d+d1>a && | |
c+b>d1 && c+d1>b && b+d1>c) { | |
if(a==b && a==c && a==d && d1!=d2) { | |
printf("\n \n Это ромб"); | |
} | |
else { | |
printf("\n \nЭто не ромб, а выпуклый четырех угольник"); | |
} | |
} | |
else { | |
printf("\n \nНесколько точек лежат на одной прямой или совпадают"); | |
} | |
} | |
else { | |
printf("\n \nКоординаты 2-х или более точек совпадают"); | |
} | |
getch(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <locale.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <math.h> | |
#include <windows.h> | |
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
main(void) { | |
setlocale(LC_ALL,"Russian"); //установка русского языка | |
// Объявление переменных | |
int i; | |
float t[4][2]; // Массив координат | |
float xa, ya, xb, yb, xc, yc, xd, yd; // Координаты точек | |
float a, b, c, d, d1, d2; // Длина сторон четырехугольника | |
float qwe; // рабочая переменная | |
printf("Лабораторная работа №1. Решения задач аналитической геометрии"); | |
Sleep(3500); | |
printf("\n\n\nПроверка точек на существования ромба"); | |
Sleep(1500); | |
printf("\n\n\nНе вводите никакие символы, кроме цифр и ,"); | |
Sleep(2500); | |
Start: printf("\n\n\nВведите:"); | |
//ввод данных | |
for(i=0; i<=3; i++) | |
{ | |
printf("\nКоординаты: %d-ой точки: \n \n \t \t x=", i+1); // ,i+1 | |
scanf("%f", &qwe); | |
t[i][0]=qwe; | |
printf("\n \t \t y="); | |
scanf("%f", &qwe); | |
t[i][1]=qwe; | |
} | |
xa=t[0][0]; | |
ya=t[0][1]; | |
xb=t[1][0]; | |
yb=t[1][1]; | |
xc=t[2][0]; | |
yc=t[2][1]; | |
xd=t[3][0]; | |
yd=t[3][1]; | |
a=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); | |
b=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)); | |
c=sqrt((xc-xd)*(xc-xd)+(yc-yd)*(yc-yd)); | |
d=sqrt((xd-xa)*(xd-xa)+(yd-ya)*(yd-ya)); | |
d1=sqrt((xd-xb)*(xd-xb)+(yd-yb)*(yd-yb)); | |
d2=sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)); | |
/*a=sqrt( (pow(xa-xb),2)+(pow(ya-yb),2) ); | |
b=sqrt((pow(xb-xc),2)+(pow(yb-yc),2)); | |
c=sqrt((pow(xc-xd),2)+(pow(yc-yd),2)); | |
d=sqrt((pow(xd-xa),2)+(pow(yd-ya),2)); */ | |
if (a>0 && b>0 && c>0 && d>0) { | |
if (a+b>d2 && a+d2>b && b+d2>a && | |
d+c>d2 && d2+d>c && c+d2>d && | |
a+d>d1 && a+d1>d && d+d1>a && | |
c+b>d1 && c+d1>b && b+d1>c) { | |
if(a==b && a==c && a==d && d1!=d2) { | |
printf("\n \n Это ромб"); | |
} | |
else { | |
printf("\n \nЭто не ромб, а выпуклый четырех угольник"); | |
} | |
} | |
else { | |
printf("\n \nНесколько точек лежат на одной прямой или совпадают"); | |
} | |
} | |
else { | |
printf("\n \nКоординаты 2-х или более точек совпадают"); | |
} | |
getch(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <locale.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <math.h> | |
#include <windows.h> | |
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
main(void) { | |
setlocale(LC_ALL,"Russian"); //установка русского языка | |
// Объявление переменных | |
int i; | |
float t[4][2]; // Массив координат | |
float xa, ya, xb, yb, xc, yc, xd, yd; // Координаты точек | |
float a, b, c, d, d1, d2; // Длина сторон четырехугольника | |
float qwe; // рабочая переменная | |
printf("Лабораторная работа №1. Решения задач аналитической геометрии"); | |
Sleep(3500); | |
printf("\n\n\nПроверка точек на существования ромба"); | |
Sleep(1500); | |
printf("\n\n\nНе вводите никакие символы, кроме цифр и ,"); | |
Sleep(2500); | |
Start: printf("\n\n\nВведите:"); | |
//ввод данных | |
for(i=0; i<=3; i++) | |
{ | |
printf("\nКоординаты: %d-ой точки: \n \n \t \t x=", i+1); // ,i+1 | |
scanf("%f", &qwe); | |
t[i][0]=qwe; | |
printf("\n \t \t y="); | |
scanf("%f", &qwe); | |
t[i][1]=qwe; | |
} | |
xa=t[0][0]; | |
ya=t[0][1]; | |
xb=t[1][0]; | |
yb=t[1][1]; | |
xc=t[2][0]; | |
yc=t[2][1]; | |
xd=t[3][0]; | |
yd=t[3][1]; | |
a=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); | |
b=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)); | |
c=sqrt((xc-xd)*(xc-xd)+(yc-yd)*(yc-yd)); | |
d=sqrt((xd-xa)*(xd-xa)+(yd-ya)*(yd-ya)); | |
d1=sqrt((xd-xb)*(xd-xb)+(yd-yb)*(yd-yb)); | |
d2=sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)); | |
/*a=sqrt( (pow(xa-xb),2)+(pow(ya-yb),2) ); | |
b=sqrt((pow(xb-xc),2)+(pow(yb-yc),2)); | |
c=sqrt((pow(xc-xd),2)+(pow(yc-yd),2)); | |
d=sqrt((pow(xd-xa),2)+(pow(yd-ya),2)); */ | |
if (a>0 && b>0 && c>0 && d>0) { | |
if (a+b>d2 && a+d2>b && b+d2>a && | |
d+c>d2 && d2+d>c && c+d2>d && | |
a+d>d1 && a+d1>d && d+d1>a && | |
c+b>d1 && c+d1>b && b+d1>c) { | |
if(a==b && a==c && a==d && d1!=d2) { | |
printf("\n \n Это ромб"); | |
} | |
else { | |
printf("\n \nЭто не ромб, а выпуклый четырех угольник"); | |
} | |
} | |
else { | |
printf("\n \nНесколько точек лежат на одной прямой или совпадают"); | |
} | |
} | |
else { | |
printf("\n \nКоординаты 2-х или более точек совпадают"); | |
} | |
getch(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <locale.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <math.h> | |
#include <windows.h> | |
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
main(void) { | |
setlocale(LC_ALL,"Russian"); //установка русского языка | |
// Объявление переменных | |
int i; | |
float t[4][2]; // Массив координат | |
float xa, ya, xb, yb, xc, yc, xd, yd; // Координаты точек | |
float a, b, c, d, d1, d2; // Длина сторон четырехугольника | |
float qwe; // рабочая переменная | |
printf("Лабораторная работа №1. Решения задач аналитической геометрии"); | |
Sleep(3500); | |
printf("\n\n\nПроверка точек на существования ромба"); | |
Sleep(1500); | |
printf("\n\n\nНе вводите никакие символы, кроме цифр и ,"); | |
Sleep(2500); | |
Start: printf("\n\n\nВведите:"); | |
//ввод данных | |
for(i=0; i<=3; i++) | |
{ | |
printf("\nКоординаты: %d-ой точки: \n \n \t \t x=", i+1); // ,i+1 | |
scanf("%f", &qwe); | |
t[i][0]=qwe; | |
printf("\n \t \t y="); | |
scanf("%f", &qwe); | |
t[i][1]=qwe; | |
} | |
xa=t[0][0]; | |
ya=t[0][1]; | |
xb=t[1][0]; | |
yb=t[1][1]; | |
xc=t[2][0]; | |
yc=t[2][1]; | |
xd=t[3][0]; | |
yd=t[3][1]; | |
a=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); | |
b=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)); | |
c=sqrt((xc-xd)*(xc-xd)+(yc-yd)*(yc-yd)); | |
d=sqrt((xd-xa)*(xd-xa)+(yd-ya)*(yd-ya)); | |
d1=sqrt((xd-xb)*(xd-xb)+(yd-yb)*(yd-yb)); | |
d2=sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)); | |
/*a=sqrt( (pow(xa-xb),2)+(pow(ya-yb),2) ); | |
b=sqrt((pow(xb-xc),2)+(pow(yb-yc),2)); | |
c=sqrt((pow(xc-xd),2)+(pow(yc-yd),2)); | |
d=sqrt((pow(xd-xa),2)+(pow(yd-ya),2)); */ | |
if (a>0 && b>0 && c>0 && d>0) { | |
if (a+b>d2 && a+d2>b && b+d2>a && | |
d+c>d2 && d2+d>c && c+d2>d && | |
a+d>d1 && a+d1>d && d+d1>a && | |
c+b>d1 && c+d1>b && b+d1>c) { | |
if(a==b && a==c && a==d && d1!=d2) { | |
printf("\n \n Это ромб"); | |
} | |
else { | |
printf("\n \nЭто не ромб, а выпуклый четырех угольник"); | |
} | |
} | |
else { | |
printf("\n \nНесколько точек лежат на одной прямой или совпадают"); | |
} | |
} | |
else { | |
printf("\n \nКоординаты 2-х или более точек совпадают"); | |
} | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment