example2_functions_with_no_parameters.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <iostream>
#include <ctime>

void printCurrentTime() {
    time_t now = time(0);
    std::cout << "Current time: " << ctime(&now);
}

int main() {
    printCurrentTime();
    return 0;
}
Back to void