File: template.cpp

package info (click to toggle)
nfstrace 0.4.3.2%2Bgit20200805%2Bb220d04-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,820 kB
  • sloc: cpp: 37,393; ansic: 2,281; sh: 357; makefile: 13
file content (83 lines) | stat: -rw-r--r-- 2,394 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//------------------------------------------------------------------------------
// Author: Pavel Karneliuk
// Description: Place for description of module. A template for source files.
// Copyright (c) 2013 EPAM Systems
//------------------------------------------------------------------------------
/*
    This file is part of Nfstrace.

    Nfstrace is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 2 of the License.

    Nfstrace is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Nfstrace.  If not, see <http://www.gnu.org/licenses/>.
*/
//------------------------------------------------------------------------------
#include <cassert> // include language headers in alphabetical order
#include <iostream>

#include <unistd.h> // then include libraries and platform headers in alphabetical order

#include "template.h" // include headers of project modules in alphabetical order
//------------------------------------------------------------------------------
// place for constants and macros
const unsigned int SayHello::BAD_COFFEE = 0xBADC0FFE;
//------------------------------------------------------------------------------
namespace hello
{
SayHello::SayHello()
    : text{"Hello, World!"}
    , value{0}
{
}
SayHello::~SayHello()
{
}

void SayHello::set_value(std::uint32_t v)
{
    value = v;
}

std::uint32_t SayHello::get_value() const
{
    return value;
}

} // namespace hello

int main(int argc, char** argv)
{
    hello::SayHello hello;
    std::cout << hello.say() << std::endl;

    hello.set(42);

    assert(42 == hello.get());

    // FizzBuzz
    for(std::size_t i = 1; i <= 100; i++)
    {
        if((i % 15) == 0)
        {
            std::cout << "FizzBuzz\n";
        }
        else if(i % 3 == 0)
            std::cout << "Fizz\n";
        else if(i % 5 == 0)
            std::cout << "Buzz\n";
        else
        {
            std::cout << i << '\n';
        }
    }

    return 0;
}
//------------------------------------------------------------------------------