C_CPP/04_UDEF/main_04_UDEF_a.cpp

49 lines
813 B
C++
Raw Normal View History

2018-03-09 09:47:53 +01:00
// file: main_04_UDEF_a.cpp
#include "../helpers/println.hpp"
#include "RationalNumber.hpp"
#include <iostream>
// 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) {
}
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);
}
int main(int argc, char** argv, char** envp){
calctype a;
calctype b;
doCalculation(a,b);
return 0;
}