Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
using namespace std; class Momche { private: char ime[101]; char prezime[101]; int godini; public: Momche() { // empty constructor } Momche(const char *i, const char *p, int g) { // constructor with strcpy(ime, i); strcpy(prezime, p); godini = g; } ~Momche() { } void pecati() { cout << "Momche: " << ime << " " << prezime << " " << godini << endl; } int get_godini() const { return godini; } }; class Devojche { private: char ime[101]; char prezime[101]; int godini; public: Devojche() { } Devojche(const char *i, const char *p, int g) { strcpy(ime, i); strcpy(prezime, p); godini = g; } ~Devojche() { } void pecati() { cout << "Devojche: " << ime << " " << prezime << " " << godini << endl; } int get_godini() const { return godini; } }; class Sredba { private: Momche m; Devojche d; public: Sredba() { } Sredba(Momche _m, Devojche _d) { m = _m; d = _d; } ~Sredba() { } void print() { m.pecati(); d.pecati(); } void daliSiOdgovaraat() { int razlika = abs(m.get_godini() - d.get_godini()); if(razlika <= 5) { cout << "Si odgovaraat" << endl; } else { cout << "Ne si odgovaraat" << endl; } } }; int main() { Momche m("a", "b", 27); Devojche d("q", "w", 20); Sredba s(m, d); s.daliSiOdgovaraat(); return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)