From 7104c90385c02473bba9880b0fcd28ffbf1940bc Mon Sep 17 00:00:00 2001 From: Justsvetoslavov Date: Mon, 17 Jan 2022 21:47:35 +0200 Subject: Add Struct tasks. --- pract_SI/Pract. 10/task1/Student.cpp | 18 ++++++++++++++++++ pract_SI/Pract. 10/task1/Student.h | 17 +++++++++++++++++ pract_SI/Pract. 10/task1/main.cpp | Bin 0 -> 3064 bytes 3 files changed, 35 insertions(+) create mode 100644 pract_SI/Pract. 10/task1/Student.cpp create mode 100644 pract_SI/Pract. 10/task1/Student.h create mode 100644 pract_SI/Pract. 10/task1/main.cpp (limited to 'pract_SI/Pract. 10/task1') diff --git a/pract_SI/Pract. 10/task1/Student.cpp b/pract_SI/Pract. 10/task1/Student.cpp new file mode 100644 index 0000000..06cf89a --- /dev/null +++ b/pract_SI/Pract. 10/task1/Student.cpp @@ -0,0 +1,18 @@ +#include "pch.h" +#include "Student.h" +#include + +float Student::calculateFinalGrade() //среден успех за годината. +{ + return (GradeFirstTerm + GradeSecondTerm) / 2; +} + +bool Student::checkBirthdate(unsigned _year) // роден преди определена година. +{ + return year < _year; +} + +void Student::enterData() +{ + std::cin >> name >> adress >> year >> GradeFirstTerm >> GradeSecondTerm; +} \ No newline at end of file diff --git a/pract_SI/Pract. 10/task1/Student.h b/pract_SI/Pract. 10/task1/Student.h new file mode 100644 index 0000000..11da143 --- /dev/null +++ b/pract_SI/Pract. 10/task1/Student.h @@ -0,0 +1,17 @@ +#pragma once +#include + +struct Student +{ + //variable Student + std::string name; + std::string adress; + unsigned year; + float GradeFirstTerm, GradeSecondTerm; + + float calculateFinalGrade(); //среден успех за годината. + + bool checkBirthdate(unsigned _year); // роден преди определена година. + + void enterData(); +}; \ No newline at end of file diff --git a/pract_SI/Pract. 10/task1/main.cpp b/pract_SI/Pract. 10/task1/main.cpp new file mode 100644 index 0000000..0fb5841 Binary files /dev/null and b/pract_SI/Pract. 10/task1/main.cpp differ -- cgit v1.3.1-23-gd82d