Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 10 / task1
diff options
context:
space:
mode:
Commit7104c90385c02473bba9880b0fcd28ffbf1940bc (patch)
Author
 Justsvetoslavov <justsvetoslavov@gmail.com>
2022-01-17 21:47:35 +0200
Committer
 Justsvetoslavov <justsvetoslavov@gmail.com>
2022-01-17 21:47:35 +0200
Files851a0e7f75b2cc097715ef74b2584e582524eb45 /pract_SI/Pract. 10/task1
Introduction_to_programming_FMI-7104c90385c02473bba9880b0fcd28ffbf1940bc.tar
Introduction_to_programming_FMI-7104c90385c02473bba9880b0fcd28ffbf1940bc.tar.gz
Introduction_to_programming_FMI-7104c90385c02473bba9880b0fcd28ffbf1940bc.zip
Parent97b4d62734acf7533a96b08bcc6044eb94847931 (diff)
Add Struct tasks.
3 files changed, 35 insertions, 0 deletions
-rw-r--r--pract_SI/Pract. 10/task1/Student.cpp18
-rw-r--r--pract_SI/Pract. 10/task1/Student.h17
-rw-r--r--pract_SI/Pract. 10/task1/main.cppbin0 -> 3064 bytes
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 <iostream>
+
+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 <string>
+
+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
--- /dev/null
+++ b/pract_SI/Pract. 10/task1/main.cpp
Binary files differ