mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 11:26:25 +02:00
[CCV] Created subdirectories
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
25
ccv/sheet1/basics/AskInteger.cpp
Normal file
25
ccv/sheet1/basics/AskInteger.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by jim on 4/4/17.
|
||||
//
|
||||
#include <iostream>
|
||||
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;
|
||||
}
|
||||
5
ccv/sheet1/basics/CMakeLists.txt
Normal file
5
ccv/sheet1/basics/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_library(Rectangle Rectangle.cpp)
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Rectangle)
|
||||
add_executable(hello hello.cpp)
|
||||
add_executable(AskInteger AskInteger.cpp)
|
||||
17
ccv/sheet1/basics/Rectangle.cpp
Normal file
17
ccv/sheet1/basics/Rectangle.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by jim on 4/4/17.
|
||||
//
|
||||
#include <iostream>
|
||||
#include "Rectangle.h"
|
||||
using namespace std;
|
||||
|
||||
Rectangle::Rectangle(unsigned int width, unsigned int height)
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
unsigned int Rectangle::area()
|
||||
{
|
||||
cout << this->width * this->height << endl;
|
||||
}
|
||||
19
ccv/sheet1/basics/Rectangle.h
Normal file
19
ccv/sheet1/basics/Rectangle.h
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by jim on 4/4/17.
|
||||
//
|
||||
|
||||
#ifndef SHEET1_RECTANGLE_H
|
||||
#define SHEET1_RECTANGLE_H
|
||||
|
||||
class Rectangle
|
||||
{
|
||||
private:
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
public:
|
||||
Rectangle(unsigned int, unsigned int);
|
||||
unsigned int area();
|
||||
};
|
||||
|
||||
#endif //SHEET1_RECTANGLE_H
|
||||
12
ccv/sheet1/basics/hello.cpp
Normal file
12
ccv/sheet1/basics/hello.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// Created by jim on 4/4/17.
|
||||
//
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello world!";
|
||||
return 0;
|
||||
}
|
||||
11
ccv/sheet1/basics/main.cpp
Normal file
11
ccv/sheet1/basics/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by jim on 4/4/17.
|
||||
//
|
||||
#include "Rectangle.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
Rectangle* rec = new Rectangle(20, 10);
|
||||
rec->area();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user