Commit 116f0a9b authored by Aurel Prestel's avatar Aurel Prestel
Browse files

adding files

parents
Pipeline #1131 passed with stage
in 1 minute and 11 seconds
build*/
*.stash
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
# Use Ubuntu Linux docker image
image: ubuntu:latest
# Defines stages which are to be executed
stages:
- build
# Setup for scripts
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt update
- apt install build-essential qt5-qmake make qtdeclarative5-dev -y
# Configure and build the project
build_bunner:
stage: build
script:
- cd praktikum/bunner
- qmake
- make
only:
- merge_requests
# Informatik 2
Dieses Repository enthält Beispiele und Vorlagen für die Veranstaltung "Informatik 2"
in den Bachelorstudiengängen Elektrotechnik und Mechatronik (HSA, Fakultät für Elektrotechnik,
Prof. Dr. Claudia Meitinger, claudia.meitinger@hs-augsburg.de).
Diese sind für den persönlichen Gebrauch der Teilnehmer:innen gedacht und dürfen nicht
ohne Rücksprache weitergegeben oder veröffentlicht werden.
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string filename("test.bin");
{
ofstream out(filename, ios::binary);
int value = 42;
out.write(reinterpret_cast<char*>(&value), sizeof(value));
out << "hello" << '\n';
}
ifstream in(filename, ios::binary);
int value;
in.read(reinterpret_cast<char*>(&value), sizeof value);
string s;
in >> s;
cout << "I got: " << value << " " << s << '\n';
return 0;
}
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
complex
/* Beispielcode zu Aufgabe zu Kopierkonstruktor/Zuweisungsoperator (einschl. kritischer Bewertung) */
#include <iostream>
#include <cmath>
using namespace std;
#include "complex.h"
Complex::Complex(double re, double im)
: m_re(re), m_im(im)
{}
Complex::Complex(const Complex &c)
{
m_re = c.m_re;
m_im = c.m_im;
}
Complex &Complex::operator=(const Complex &c)
{
m_re = c.m_re;
m_im = c.m_im;
}
Complex::~Complex() {}
double Complex::betrag()
{
return sqrt(m_re*m_re + m_im*m_im);
}
Complex Complex::operator+(const Complex &b)
{
Complex ergebnis;
ergebnis.m_re = m_re + b.m_re;
ergebnis.m_im = m_im + b.m_im;
return ergebnis;
}
void Complex::anzeigen()
{
cout << m_re << " + i * " << m_im << endl;
}
/* Beispielcode zu Aufgabe zu Kopierkonstruktor/Zuweisungsoperator (einschl. kritischer Bewertung) */
#ifndef COMPLEX_H
#define COMPLEX_H
class Complex
{
private:
double m_re; // Realteil
double m_im; // Imaginaerteil
public:
Complex(double re = 0.0, double im = 0.0);
Complex(const Complex &c);
Complex &operator=(const Complex &c);
~Complex();
double betrag();
Complex operator+(const Complex &b);
void anzeigen();
};
#endif // COMPLEX_H
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp \
complex.cpp
HEADERS += \
complex.h
/* Beispielcode zu Aufgabe zu Kopierkonstruktor/Zuweisungsoperator (einschl. kritischer Bewertung) */
#include <iostream>
using namespace std;
#include "complex.h"
int main()
{
Complex c1(5,4), c2(c1), c3;
c3 = c1 + c2;
c1.anzeigen();
c2.anzeigen();
c3.anzeigen();
return 0;
}
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
#include <iostream>
using namespace std;
void permutation(char feld[], int n)
{
char temp;
if (n == 1) {
cout << "Kombination: " << feld << endl ;
}
else {
permutation(feld, n-1);
for (int i = n - 2; i >= 0; i--) {
temp = feld[n-1];
feld[n-1] = feld[i];
feld[i] = temp;
permutation(feld, n-1);
temp = feld[n-1];
feld[n-1] = feld[i];
feld[i] = temp;
}
}
}
int main()
{
char pin[] = { '3', '5', '8', '\0' };
permutation(pin, 3);
return 0;
}
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
/aufgabe_punktKreis
#include "kreis.h"
Kreis::Kreis(const Punkt &mittelpunkt)
{
// ...
}
#ifndef KREIS_H
#define KREIS_H
#include "punkt.h"
class Kreis
{
public:
Kreis(const Punkt &mittelpunkt);
private:
Punkt m_mittelpunkt;
double m_radius;
};
#endif // KREIS_H
/**
* Code zu AUFGABE Punkt/Kreis (const)
* (teilweise absichtlich fehlerhaft)
*/
#include <iostream>
using namespace std;
#include "punkt.h"
int main()
{
Punkt p1("P1");
p1.show();
p1.move(-5, -3);
p1.show();
const Punkt p2("Ursprung");
p2.show();
return 0;
}
#include "punkt.h"
#include <iostream>
using namespace std;
Punkt::Punkt(string name, double x, double y)
: m_x(x), m_y(y)
{
m_name = name;
}
Punkt::~Punkt()
{
}