Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 07 / Person
diff options
context:
space:
mode:
Commit8cf1283a4ffb9fe1901c29c087fa376de82726af (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Filesabdfe6bf526100dcce87a88563100e02adf7605e /Sem. 07/Person
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar.gz
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.zip
Parentd73a7ec225516657dec74472a0491330e9999217 (diff)
clean up
3 files changed, 0 insertions, 75 deletions
-rw-r--r--Sem. 07/Person/Person.cpp40
-rw-r--r--Sem. 07/Person/Person.h19
-rw-r--r--Sem. 07/Person/Source.cpp16
diff --git a/Sem. 07/Person/Person.cpp b/Sem. 07/Person/Person.cpp
deleted file mode 100644
index 2786671..0000000
--- a/Sem. 07/Person/Person.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <iostream>
-#include "Person.h"
-
-Person::Person(const char* name, int age)
-{
- setName(name);
- setAge(age);
-}
-
-
-void Person::setName(const char* name)
-{
- if (strlen(name) >= 20)
- {
- strcpy(this->name, "Unknown");
- }
- else
- {
- strcpy(this->name, name);
- }
-}
-
-void Person::setAge(int age)
-{
- if (age<0 || age > 120)
- age = 40;
- this->age = age;
-}
-const char* Person::getName() const
-{
- return name;
-}
-int Person::getAge() const
-{
- return age;
-}
-void Person::print()
-{
- std::cout << name << " " << age << std::endl;
-} \ No newline at end of file
diff --git a/Sem. 07/Person/Person.h b/Sem. 07/Person/Person.h
deleted file mode 100644
index 499c744..0000000
--- a/Sem. 07/Person/Person.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-class Person
-{
-public:
- Person(const char* name, int age);
-
- void setName(const char* name);
- void setAge(int age);
-
- const char* getName() const;
- int getAge() const;
-
- void print();
-
-private:
- char name[20];
- int age;
-};
diff --git a/Sem. 07/Person/Source.cpp b/Sem. 07/Person/Source.cpp
deleted file mode 100644
index 478d07a..0000000
--- a/Sem. 07/Person/Source.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <iostream>
-#include "Person.h"
-using namespace std;
-
-int main()
-{
- Person p("Ivan", 13);
- Person p2("Petur", 12);
-
- p = p2;
-
- p2.setName("Aleks");
- p.print();
- p2.print();
-
-}