23 lines
648 B
C++
23 lines
648 B
C++
|
#include <iostream>
|
||
|
#include "date.h" // Inkludera Date-klassen från tidigare lösning
|
||
|
#include "toString.h" // Inkludera toString-mallen
|
||
|
|
||
|
int main() {
|
||
|
// Testa med ett primitivt datatyper
|
||
|
double d = 1.234;
|
||
|
int i = 42;
|
||
|
std::string strDouble = toString(d);
|
||
|
std::string strInt = toString(i);
|
||
|
|
||
|
std::cout << "Double as string: " << strDouble << std::endl;
|
||
|
std::cout << "Integer as string: " << strInt << std::endl;
|
||
|
|
||
|
// Testa med Date-klassen
|
||
|
Date today(2023, 12, 11); // Skapa ett datumobjekt
|
||
|
std::string strDate = toString(today);
|
||
|
|
||
|
std::cout << "Date as string: " << strDate << std::endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|