48 lines
772 B
C++
48 lines
772 B
C++
// file: main_04_UDEF_a.cpp
|
|
#include "../../helpers/println.hpp"
|
|
#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
|
|
|
|
RationalNumber operator+(RationalNumber a, RationalNumber b) {
|
|
return a;
|
|
}
|
|
|
|
std::string as_string(RationalNumber rationalNumber) {
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
int main(){
|
|
|
|
calctype a;
|
|
calctype b;
|
|
|
|
doCalculation(a,b);
|
|
|
|
return 0;
|
|
}
|