funktionsheader und funktionsnamespace hinzugefügt
This commit is contained in:
16
ax_funktions.hpp
Normal file
16
ax_funktions.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//Funktionsdeklaration ax_funktions.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ax{
|
||||
void print_number(int x)
|
||||
{
|
||||
std::cout << "Die Zahl ist: " << x << std::endl;
|
||||
std::cout << "Das doppelte der Zahl ist: " << x*2 << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int sqrt(int x){
|
||||
return x*x;
|
||||
}
|
||||
}
|
||||
22
main.cpp
22
main.cpp
@@ -1,9 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "ax_funktions.hpp"
|
||||
|
||||
int number = 12;
|
||||
|
||||
void print_number (int);
|
||||
int sqrt (int);
|
||||
|
||||
main()
|
||||
{
|
||||
@@ -15,22 +14,9 @@ main()
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
print_number(i); // neue Funktion unsicher und unvollständig
|
||||
ax::print_number(i); // neue Funktion unsicher und unvollständig
|
||||
}
|
||||
|
||||
print_number(sqrt(3));
|
||||
ax::print_number(ax::sqrt(3));
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
void print_number(int x)
|
||||
{
|
||||
std::cout << "Die Zahl ist: " << x << std::endl;
|
||||
std::cout << "Das doppelte der Zahl ist: " << x*2 << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int sqrt(int x){
|
||||
return x*x;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user