diff --git a/ccv/sheet1/AskInteger.cpp b/ccv/sheet1/AskInteger.cpp new file mode 100644 index 0000000..233fafd --- /dev/null +++ b/ccv/sheet1/AskInteger.cpp @@ -0,0 +1,25 @@ +// +// Created by jim on 4/4/17. +// +#include +using namespace std; + +int main() +{ + int input; + cout << "Bitte geben Sie eine Zahl ein." << endl; + cin >> input; + if (input > 9) + { + cout << input << " ist größer gleich 10." << endl; + } + else if (input >= 0) + { + cout << input << " liegt zwischen einschließlich 0 und 9." << endl; + } + else + { + cout << input << " ist negativ." << endl; + } + return 0; +} diff --git a/ccv/sheet1/Rectangle.cpp b/ccv/sheet1/Rectangle.cpp new file mode 100644 index 0000000..7d30a0c --- /dev/null +++ b/ccv/sheet1/Rectangle.cpp @@ -0,0 +1,30 @@ +// +// Created by jim on 4/4/17. +// +#include +using namespace std; + +class Rectangle +{ +private: + unsigned int width; + unsigned int height; + +public: + Rectangle(unsigned int width, unsigned int height) + { + this->width = width; + this->height = height; + } + + unsigned int area() + { + return this->height * this->width; + } +}; + +int main() +{ + Rectangle* rec = new Rectangle(10, 20); + cout << rec->area() << endl; +} diff --git a/ccv/sheet1/hello.cpp b/ccv/sheet1/hello.cpp new file mode 100644 index 0000000..dd473d6 --- /dev/null +++ b/ccv/sheet1/hello.cpp @@ -0,0 +1,12 @@ +// +// Created by jim on 4/4/17. +// +#include +#include +using namespace std; + +int main() +{ + std::cout << "Hello world!"; + return 0; +}