C_CPP/04_UDEF/MP/main_04_UDEF_a.cpp

48 lines
772 B
C++
Raw Normal View History

2018-03-09 09:47:53 +01:00
// file: main_04_UDEF_a.cpp
2018-08-19 18:30:13 +02:00
#include "../../helpers/println.hpp"
2018-03-09 09:47:53 +01:00
#include "RationalNumber.hpp"
// location 1
// this declares an alias for type <see below>, which is called calctype
//typedef unsigned int calctype;
//typedef int calctype;
//typedef double calctype;
typedef RationalNumber calctype;
// location 2
2018-06-08 16:52:00 +02:00
RationalNumber operator+(RationalNumber a, RationalNumber b) {
2018-06-18 19:00:00 +02:00
return a;
2018-06-08 16:52:00 +02:00
}
std::string as_string(RationalNumber rationalNumber) {
}
2018-03-09 09:47:53 +01:00
void doCalculation(calctype a, calctype b){
calctype c = a + b;
// here is some advanced computation on arguments a and b
// for(){ ...
// if(){ ...
// for(){ ...
println("a = ", a);
println("b = ", b);
println("c = ", c);
}
2018-06-08 17:01:12 +02:00
int main(){
2018-03-09 09:47:53 +01:00
calctype a;
calctype b;
doCalculation(a,b);
return 0;
}