Лабораторная работа №1 - Определение потомков мужского пола - файл n1.docx

Лабораторная работа №1 - Определение потомков мужского пола
скачать (2852.6 kb.)
Доступные файлы (612):
n1.docx128kb.12.04.2012 21:27скачать
n2.bat
n3.exe
n4.dll
n5.dll
Shell_api.6DBDD40C.deb
Shell_api.6DBDD40C.obj
_builtIn_cl.Scope
_builtIn_pro.Scope
_global_pro.Scope
binary.E49EA1AC.deb
binary.E49EA1AC.obj
binary_cl.Scope
binary_exception_cl.Scope
binary_exception_pro.Scope
binary_pro.Scope
bit_cl.Scope
bit_pro.Scope
boolean.F57FBC65.deb
boolean.F57FBC65.obj
boolean_cl.Scope
boolean_pro.Scope
bufferSupport_i.Scope
n24.lnk
collection.88EBCD35.deb
collection.88EBCD35.obj
collectionMsupport.5D6E2512.deb
collectionMsupport.5D6E2512.obj
collectionSupportM$collectionMsite_$1_i.Scope
collectionSupportM$collectionMsupport_$1_cl.Scope
collectionSupportM$collectionMsupport_$1_i.Scope
collectionSupportM$collectionMsupport_$1_pro.Scope
collectionSupportM$mapMSite_$2_i.Scope
collectionSupportM$mapMSupport_$2_cl.Scope
collectionSupportM$mapMSupport_$2_pro.Scope
collection_$1_i.Scope
common_exception_cl.Scope
common_exception_pro.Scope
console.15164101.deb
console.15164101.obj
console_api.DAC5AF09.deb
console_api.DAC5AF09.obj
console_api_cl.Scope
console_api_pro.Scope
console_cl.Scope
console_native_cl.Scope
console_native_pro.Scope
console_pro.Scope
core.FAEE4BC5.deb
core.FAEE4BC5.obj
core_cl.Scope
core_pro.Scope
directory_cl.Scope
directory_pro.Scope
disposable_i.Scope
errorDescriptorInformation_cl.Scope
errorDescriptorInformation_i.Scope
errorDescriptorInformation_pro.Scope
exception.7CD8A5A6.deb
exception.7CD8A5A6.obj
exceptionDump.9D36300C.deb
exceptionDump.9D36300C.obj
exceptionDump_cl.Scope
exceptionDump_pro.Scope
exception_cl.Scope
exception_exception_cl.Scope
exception_exception_pro.Scope
exception_pro.Scope
exe.0F8C8044.deb
exe.0F8C8044.obj
exe_api.0F4DAC81.deb
exe_api.0F4DAC81.obj
exe_api_cl.Scope
exe_api_pro.Scope
exe_native_cl.Scope
exe_native_pro.Scope
fileName_cl.Scope
fileName_pro.Scope
fileSystem.1A846043.deb
fileSystem.1A846043.obj
fileSystem_api.8783FFDC.deb
fileSystem_api.8783FFDC.obj
fileSystem_api_cl.Scope
fileSystem_api_pro.Scope
fileSystem_exception_cl.Scope
fileSystem_exception_pro.Scope
fileSystem_native_cl.Scope
fileSystem_native_pro.Scope
fileVersion_cl.Scope
fileVersion_pro.Scope
file_cl.Scope
file_pro.Scope
gui_api.E0EEBFAE.deb
gui_api.E0EEBFAE.obj
gui_api_cl.Scope
gui_api_pro.Scope
gui_native_cl.Scope
gui_native_pro.Scope
inputBuffer_i.Scope
inputStreamSupport.68236F82.deb
inputStreamSupport.68236F82.obj
inputStream_binary_cl.Scope
inputStream_binary_pro.Scope
inputStream_console_cl.Scope
inputStream_console_pro.Scope
inputStream_file_cl.Scope
inputStream_file_pro.Scope
inputStream_i.Scope
inputStream_null_cl.Scope
inputStream_null_pro.Scope
inputStream_string_cl.Scope
inputStream_string_pro.Scope
inputSupport_cl.Scope
inputSupport_i.Scope
inputSupport_pro.Scope
lZ_fileSystem_native_cl.Scope
lZ_fileSystem_native_pro.Scope
n118.bro
n119.env
n120.map
n121.res
list.DBC1226D.deb
list.DBC1226D.obj
list_cl.Scope
list_pro.Scope
locale_api.F7E425DD.deb
locale_api.F7E425DD.obj
locale_api_cl.Scope
locale_api_pro.Scope
locale_native_cl.Scope
locale_native_pro.Scope
main.A22FE9BF.deb
main.A22FE9BF.obj
mainExe_cl.Scope
mainExe_pro.Scope
main_cl.Scope
main_pro.Scope
mapMSupport.7D9E6A86.deb
mapMSupport.7D9E6A86.obj
mapMSupport_$2_i.Scope
mapM_$2_i.Scope
mapM_redBlack.A82482B6.deb
mapM_redBlack.A82482B6.obj
mapM_redBlack_$2_cl.Scope
mapM_redBlack_$2_pro.Scope
mapP_$3_i.Scope
map_$2_i.Scope
math.EAC7B29F.deb
math.EAC7B29F.obj
math_cl.Scope
math_exception_cl.Scope
math_exception_pro.Scope
math_pro.Scope
memory.500229DD.deb
memory.500229DD.obj
memory_api.CFCB27B9.deb
memory_api.CFCB27B9.obj
memory_cl.Scope
memory_native_cl.Scope
memory_native_pro.Scope
memory_pro.Scope
messageFile_cl.Scope
messageFile_pro.Scope
modifiable_$1_i.Scope
multiThread_api.96F0635C.deb
multiThread_api.96F0635C.obj
multiThread_api_cl.Scope
multiThread_api_pro.Scope
multiThread_native_cl.Scope
multiThread_native_pro.Scope
namedValue.8B635E2D.deb
namedValue.8B635E2D.obj
namedValue_cl.Scope
namedValue_pro.Scope
outputBuffer_i.Scope
outputStreamSupport.82FF1102.deb
outputStreamSupport.82FF1102.obj
outputStream_binary_cl.Scope
outputStream_binary_i.Scope
outputStream_binary_pro.Scope
outputStream_console_cl.Scope
outputStream_console_pro.Scope
outputStream_file_cl.Scope
outputStream_file_pro.Scope
outputStream_i.Scope
outputStream_null_cl.Scope
outputStream_null_pro.Scope
outputStream_string_cl.Scope
outputStream_string_i.Scope
outputStream_string_pro.Scope
outputSupport_cl.Scope
outputSupport_i.Scope
outputSupport_pro.Scope
persistent_$2_i.Scope
programControl.78DF5AAB.deb
programControl.78DF5AAB.obj
programControl_cl.Scope
programControl_pro.Scope
queueM_$1_i.Scope
queueP_$2_i.Scope
redBlackSet.1BA89B8A.deb
redBlackSet.1BA89B8A.obj
redBlackSet_cl.Scope
redBlackSet_pro.Scope
redBlackTree.F39652E5.deb
redBlackTree.F39652E5.obj
redBlackTree_cl.Scope
redBlackTree_pro.Scope
registry.00A93D13.deb
registry.00A93D13.obj
registry_api.946BC00D.deb
registry_api.946BC00D.obj
registry_api_cl.Scope
registry_api_pro.Scope
registry_cl.Scope
registry_exception_cl.Scope
registry_exception_pro.Scope
registry_native_cl.Scope
registry_native_pro.Scope
registry_pro.Scope
runTime_api.91ECF079.deb
runTime_api.91ECF079.obj
runtimeLinkNamesRun_i.Scope
runtime_api_cl.Scope
runtime_api_pro.Scope
runtime_exception_cl.Scope
runtime_exception_pro.Scope
setM_$1_i.Scope
setM_redBlack.B7C8A69F.deb
setM_redBlack.B7C8A69F.obj
setM_redBlack_$1_cl.Scope
setM_redBlack_$1_pro.Scope
setP_$2_i.Scope
shell_api_cl.Scope
shell_api_pro.Scope
shell_native_cl.Scope
shell_native_pro.Scope
std.8E7BCEC2.deb
std.8E7BCEC2.obj
std_cl.Scope
std_pro.Scope
stdioState_cl.Scope
stdioState_i.Scope
stdioState_pro.Scope
stdio_cl.Scope
stdio_pro.Scope
stream.7F811E24.deb
stream.7F811E24.obj
stream_exception_cl.Scope
stream_exception_pro.Scope
stream_i.Scope
string.9BF9C2A1.deb
string.9BF9C2A1.obj
string8.16ED61C7.deb
string8.16ED61C7.obj
string8_api.5C9617C6.deb
string8_api.5C9617C6.obj
string8_api_cl.Scope
string8_api_pro.Scope
string8_cl.Scope
string8_native_cl.Scope
string8_native_pro.Scope
string8_pro.Scope
string_api.350A39F1.deb
string_api.350A39F1.obj
string_cl.Scope
string_exception_cl.Scope
string_exception_pro.Scope
string_native_cl.Scope
string_native_pro.Scope
string_pro.Scope
systemInformation_api.F4E4155D.deb
systemInformation_api.F4E4155D.obj
systemInformation_api_cl.Scope
systemInformation_api_pro.Scope
systemInformation_native_cl.Scope
systemInformation_native_pro.Scope
n278.scopeinfo
time_api.4D48EE6A.deb
time_api.4D48EE6A.obj
time_api_cl.Scope
time_api_pro.Scope
time_native_cl.Scope
time_native_pro.Scope
trapInformationObject_i.Scope
vpiDomains.F100C7DB.deb
vpiDomains.F100C7DB.obj
vpiDomains_cl.Scope
vpiDomains_pro.Scope
vpiOwnerDraw_cl.Scope
vpiOwnerDraw_pro.Scope
weakPointer_cl.Scope
weakPointer_i.Scope
weakPointer_pro.Scope
winErrors_cl.Scope
windowsAPI.808F2445.deb
windowsAPI.808F2445.obj
windowsAPI_cl.Scope
windowsAPI_pro.Scope
n300.prj6
n301.cl
n302.manifest
n303.pack
n304.ph
n305.pro
n306.i
n307.bat
n308.exe
n309.dll
n310.dll
Shell_api.6DBDD40C.deb
Shell_api.6DBDD40C.obj
_builtIn_cl.Scope
_builtIn_pro.Scope
_global_pro.Scope
binary.E49EA1AC.deb
binary.E49EA1AC.obj
binary_cl.Scope
binary_exception_cl.Scope
binary_exception_pro.Scope
binary_pro.Scope
bit_cl.Scope
bit_pro.Scope
boolean.F57FBC65.deb
boolean.F57FBC65.obj
boolean_cl.Scope
boolean_pro.Scope
bufferSupport_i.Scope
n329.lnk
collection.88EBCD35.deb
collection.88EBCD35.obj
collectionMsupport.5D6E2512.deb
collectionMsupport.5D6E2512.obj
collectionSupportM$collectionMsite_$1_i.Scope
collectionSupportM$collectionMsupport_$1_cl.Scope
collectionSupportM$collectionMsupport_$1_i.Scope
collectionSupportM$collectionMsupport_$1_pro.Scope
collectionSupportM$mapMSite_$2_i.Scope
collectionSupportM$mapMSupport_$2_cl.Scope
collectionSupportM$mapMSupport_$2_pro.Scope
collection_$1_i.Scope
common_exception_cl.Scope
common_exception_pro.Scope
console.15164101.deb
console.15164101.obj
console_api.DAC5AF09.deb
console_api.DAC5AF09.obj
console_api_cl.Scope
console_api_pro.Scope
console_cl.Scope
console_native_cl.Scope
console_native_pro.Scope
console_pro.Scope
core.FAEE4BC5.deb
core.FAEE4BC5.obj
core_cl.Scope
core_pro.Scope
directory_cl.Scope
directory_pro.Scope
disposable_i.Scope
errorDescriptorInformation_cl.Scope
errorDescriptorInformation_i.Scope
errorDescriptorInformation_pro.Scope
exception.7CD8A5A6.deb
exception.7CD8A5A6.obj
exceptionDump.9D36300C.deb
exceptionDump.9D36300C.obj
exceptionDump_cl.Scope
exceptionDump_pro.Scope
exception_cl.Scope
exception_exception_cl.Scope
exception_exception_pro.Scope
exception_pro.Scope
exe.0F8C8044.deb
exe.0F8C8044.obj
exe_api.0F4DAC81.deb
exe_api.0F4DAC81.obj
exe_api_cl.Scope
exe_api_pro.Scope
exe_native_cl.Scope
exe_native_pro.Scope
fileName_cl.Scope
fileName_pro.Scope
fileSystem.1A846043.deb
fileSystem.1A846043.obj
fileSystem_api.8783FFDC.deb
fileSystem_api.8783FFDC.obj
fileSystem_api_cl.Scope
fileSystem_api_pro.Scope
fileSystem_exception_cl.Scope
fileSystem_exception_pro.Scope
fileSystem_native_cl.Scope
fileSystem_native_pro.Scope
fileVersion_cl.Scope
fileVersion_pro.Scope
file_cl.Scope
file_pro.Scope
gui_api.E0EEBFAE.deb
gui_api.E0EEBFAE.obj
gui_api_cl.Scope
gui_api_pro.Scope
gui_native_cl.Scope
gui_native_pro.Scope
inputBuffer_i.Scope
inputStreamSupport.68236F82.deb
inputStreamSupport.68236F82.obj
inputStream_binary_cl.Scope
inputStream_binary_pro.Scope
inputStream_console_cl.Scope
inputStream_console_pro.Scope
inputStream_file_cl.Scope
inputStream_file_pro.Scope
inputStream_i.Scope
inputStream_null_cl.Scope
inputStream_null_pro.Scope
inputStream_string_cl.Scope
inputStream_string_pro.Scope
inputSupport_cl.Scope
inputSupport_i.Scope
inputSupport_pro.Scope
lZ_fileSystem_native_cl.Scope
lZ_fileSystem_native_pro.Scope
n423.bro
n424.env
n425.map
n426.res
list.DBC1226D.deb
list.DBC1226D.obj
list_cl.Scope
list_pro.Scope
locale_api.F7E425DD.deb
locale_api.F7E425DD.obj
locale_api_cl.Scope
locale_api_pro.Scope
locale_native_cl.Scope
locale_native_pro.Scope
main.A22FE9BF.deb
main.A22FE9BF.obj
mainExe_cl.Scope
mainExe_pro.Scope
main_cl.Scope
main_pro.Scope
mapMSupport.7D9E6A86.deb
mapMSupport.7D9E6A86.obj
mapMSupport_$2_i.Scope
mapM_$2_i.Scope
mapM_redBlack.A82482B6.deb
mapM_redBlack.A82482B6.obj
mapM_redBlack_$2_cl.Scope
mapM_redBlack_$2_pro.Scope
mapP_$3_i.Scope
map_$2_i.Scope
math.EAC7B29F.deb
math.EAC7B29F.obj
math_cl.Scope
math_exception_cl.Scope
math_exception_pro.Scope
math_pro.Scope
memory.500229DD.deb
memory.500229DD.obj
memory_api.CFCB27B9.deb
memory_api.CFCB27B9.obj
memory_cl.Scope
memory_native_cl.Scope
memory_native_pro.Scope
memory_pro.Scope
messageFile_cl.Scope
messageFile_pro.Scope
modifiable_$1_i.Scope
multiThread_api.96F0635C.deb
multiThread_api.96F0635C.obj
multiThread_api_cl.Scope
multiThread_api_pro.Scope
multiThread_native_cl.Scope
multiThread_native_pro.Scope
namedValue.8B635E2D.deb
namedValue.8B635E2D.obj
namedValue_cl.Scope
namedValue_pro.Scope
outputBuffer_i.Scope
outputStreamSupport.82FF1102.deb
outputStreamSupport.82FF1102.obj
outputStream_binary_cl.Scope
outputStream_binary_i.Scope
outputStream_binary_pro.Scope
outputStream_console_cl.Scope
outputStream_console_pro.Scope
outputStream_file_cl.Scope
outputStream_file_pro.Scope
outputStream_i.Scope
outputStream_null_cl.Scope
outputStream_null_pro.Scope
outputStream_string_cl.Scope
outputStream_string_i.Scope
outputStream_string_pro.Scope
outputSupport_cl.Scope
outputSupport_i.Scope
outputSupport_pro.Scope
persistent_$2_i.Scope
programControl.78DF5AAB.deb
programControl.78DF5AAB.obj
programControl_cl.Scope
programControl_pro.Scope
queueM_$1_i.Scope
queueP_$2_i.Scope
redBlackSet.1BA89B8A.deb
redBlackSet.1BA89B8A.obj
redBlackSet_cl.Scope
redBlackSet_pro.Scope
redBlackTree.F39652E5.deb
redBlackTree.F39652E5.obj
redBlackTree_cl.Scope
redBlackTree_pro.Scope
registry.00A93D13.deb
registry.00A93D13.obj
registry_api.946BC00D.deb
registry_api.946BC00D.obj
registry_api_cl.Scope
registry_api_pro.Scope
registry_cl.Scope
registry_exception_cl.Scope
registry_exception_pro.Scope
registry_native_cl.Scope
registry_native_pro.Scope
registry_pro.Scope
runTime_api.91ECF079.deb
runTime_api.91ECF079.obj
runtimeLinkNamesRun_i.Scope
runtime_api_cl.Scope
runtime_api_pro.Scope
runtime_exception_cl.Scope
runtime_exception_pro.Scope
setM_$1_i.Scope
setM_redBlack.B7C8A69F.deb
setM_redBlack.B7C8A69F.obj
setM_redBlack_$1_cl.Scope
setM_redBlack_$1_pro.Scope
setP_$2_i.Scope
shell_api_cl.Scope
shell_api_pro.Scope
shell_native_cl.Scope
shell_native_pro.Scope
std.8E7BCEC2.deb
std.8E7BCEC2.obj
std_cl.Scope
std_pro.Scope
stdioState_cl.Scope
stdioState_i.Scope
stdioState_pro.Scope
stdio_cl.Scope
stdio_pro.Scope
stream.7F811E24.deb
stream.7F811E24.obj
stream_exception_cl.Scope
stream_exception_pro.Scope
stream_i.Scope
string.9BF9C2A1.deb
string.9BF9C2A1.obj
string8.16ED61C7.deb
string8.16ED61C7.obj
string8_api.5C9617C6.deb
string8_api.5C9617C6.obj
string8_api_cl.Scope
string8_api_pro.Scope
string8_cl.Scope
string8_native_cl.Scope
string8_native_pro.Scope
string8_pro.Scope
string_api.350A39F1.deb
string_api.350A39F1.obj
string_cl.Scope
string_exception_cl.Scope
string_exception_pro.Scope
string_native_cl.Scope
string_native_pro.Scope
string_pro.Scope
systemInformation_api.F4E4155D.deb
systemInformation_api.F4E4155D.obj
systemInformation_api_cl.Scope
systemInformation_api_pro.Scope
systemInformation_native_cl.Scope
systemInformation_native_pro.Scope
n583.scopeinfo
time_api.4D48EE6A.deb
time_api.4D48EE6A.obj
time_api_cl.Scope
time_api_pro.Scope
time_native_cl.Scope
time_native_pro.Scope
trapInformationObject_i.Scope
vpiDomains.F100C7DB.deb
vpiDomains.F100C7DB.obj
vpiDomains_cl.Scope
vpiDomains_pro.Scope
vpiOwnerDraw_cl.Scope
vpiOwnerDraw_pro.Scope
weakPointer_cl.Scope
weakPointer_i.Scope
weakPointer_pro.Scope
winErrors_cl.Scope
windowsAPI.808F2445.deb
windowsAPI.808F2445.obj
windowsAPI_cl.Scope
windowsAPI_pro.Scope
n605.txt1kb.18.03.2012 14:19скачать
n606.prj6
n607.cl
n608.manifest
n609.pack
n610.ph
n611.pro
n612.i

n1.docx

ГОУ ВПО

Уфимский Государственный Авиационный Технический Университет


Кафедра ТК
Лабораторная работа №1

Выполнил: ст. гр. УТС-318

Кадыров В. Р.

Проверил:

Хасанов А. Ю.

Уфа 2012
Задание 1:

Определить предикат потомки мужского пола и найти всех потомков мужского пола и потомков мужского пола конкретного лица.
Дерево потомков



Листинг программы:


implement main
    open core

constants
    className = "main".
    classVersion = "".

domains
    gender = female(); male().
    
class facts -factdb
    person:(string Name, gender Gender).
    parent:(string Person, string Parent).
    
class predicates
    descendent:(string Person, string Descendent) nondeterm (i,o)(o,o).
    maledescendent:(string Person, string Mdescendent)nondeterm (i,o)(o,o).

clauses
    classInfo(className, classVersion).
    descendent(Person, Descendent):-
        parent(Descendent, Person).
    descendent(Person, Descendent):-
        parent(P1, Person),
        descendent(P1, Descendent).
    maledescendent(Person, Mdescendent):-
        descendent(Person, Mdescendent),
        person(Mdescendent, male()).
        
class predicates
        reconsult : (string FileName).
    clauses
        reconsult(FileName) :-
            file::consult(FileName, factDB).

clauses
    run():-
        reconsult("..\\facts.txt"),
        console::init(),
        stdIO::write("Поиск потомков мужского пола\nВведите имя предка (пустой запрос для вывода полного списка): "),
        X = stdIO::readLine(),
        if X="",! 
            then stdIO::write("\nСписок всех потомков мужского пола:\n\n"),
            maledescendent(X1, Y1),
                stdIO::writef("% потомок-мужчина для %\n", Y1, X1),
                fail 
        end if,
        maledescendent(X, Y),
            stdIO::writef("% является потомком-мужчиной для %\n", Y, X),
        fail.
    run():-
        stdIO::writef("\nСписок потомков выведен полностью. Нажмите Enter для закрытия..."),
        _=stdIO::readLine(). 
        
end implement main

goal
    mainExe::run(main::run).
Тест:





Задание 2:

Заданы 2 круга. Один с центром в (х1, у1) и радиусом r1, и другой соответственно (х2,у2) и r2. Определить взаимное расположение кругов.
Листинг:


implement main
    open core, console, math
 
    constants
        className = "main".
        classVersion = "$JustDate: 2007-06-22 $$Revision: 1 $".
 
    clauses
        classInfo(className, classVersion).

 
    class predicates
        circle : (real X1, real Y1, real R1, real X2, real Y2, real R2, string S) nondeterm (i,i,i,i,i,i,o).
        dist: (real X1, real Y1, real X2, real Y2, real Distance) procedure (i,i,i,i,o).
        
        
     clauses
        dist(X1, Y1, X2, Y2, D):-
            D=sqrt((X1-X2)^2+(Y1-Y2)^2).
        circle(_,_,R1,_,_,R2,S):-
            R1<0,
            S="Введен отрицательный радиус\n"
            or 
            R2<0,
            S="Введен отрицательный радиус\n".
        circle(X1,Y1,R1,X2,Y2,R2,S):-
            X1=X2,
            Y1=Y2,
            R1=R2,
            S="Круги совпадают\n".
        circle(X1,Y1,R1,X2,Y2,R2,S):-
            dist(X1, Y1, X2, Y2, D),
            D+R1<=R2,
            S="Первый круг внутри второго\n"
            or 
            dist(X1, Y1, X2, Y2, D),
            D+R2<=R1,
            S="Второй круг внутри первого\n".
        circle(X1,Y1,R1,X2,Y2,R2,S):-
            dist(X1, Y1, X2, Y2, D),
            D=R1+R2,
            S="Круги соприкасаются\n".
        circle(X1,Y1,R1,X2,Y2,R2,S):-
            dist(X1, Y1, X2, Y2, D),
            D            S="Круги пересекаются\n".
        circle(X1,Y1,R1,X2,Y2,R2,S):-
            dist(X1, Y1, X2, Y2, D),
            D>R1+R2,
            S="Круги не пересекаются\n".
    clauses
        run():-
            write ("\nВведите X1:"),
            X1=read(),
            write ("\nВведите Y1:"),
            Y1=read(),
            write ("\nВведите R1:"),
            R1=read(),
            write ("\nВведите X2:"),
            X2=read(),
            write ("\nВведите Y2:"),
            Y2=read(),
            write ("\nВведите R2:"),
            R2=read(),
            circle (X1,Y1,R1,X2,Y2,R2,S),
            write("\n", S),
            clearInput(),     
            !,
            run();
            run().
end implement main
 
goal
    mainExe::run(main::run).


Тест:


Вывод: в ходе данной лабораторной работы была изучена структура программ на Прологе, были составлены простейшие программы с использованием фактов и правил.

Учебный материал
© nashaucheba.ru
При копировании укажите ссылку.
обратиться к администрации