#Include #Include #Include Using Namespace Int: Declaring Functions
#Include #Include #Include Using Namespace Int: Declaring Functions
#Include #Include #Include Using Namespace Int: Declaring Functions
#include<cmath>
#include <ctime>
using namespace std;
int main()
{
time_t t = time(NULL);
tm* tPtr = localtime(&t);
cout << "\n\n Display the Current Date and Time :\n";
cout << "----------------------------------------\n";
cout << " seconds = " << (tPtr->tm_sec) << endl;
cout << " minutes = " << (tPtr->tm_min) << endl;
cout << " hours = " << (tPtr->tm_hour) << endl;
cout << " day of month = " << (tPtr->tm_mday) << endl;
cout << " month of year = " << (tPtr->tm_mon)+1 << endl;
cout << " year = " << (tPtr->tm_year)+1900 << endl;
cout << " weekday = " << (tPtr->tm_wday )<< endl;
cout << " day of year = " << (tPtr->tm_yday )<< endl;
cout << " daylight savings = " <<(tPtr->tm_isdst )<< endl;
cout << endl;
cout << endl;
Declaring Functions
int main()
{
int i;
do {
cout << "Type a number (0 to exit): ";
cin >> i;
odd (i);
} while (i!=0);
system("pause");
return 0;
}
void odd(int a)
{
if ((a%2)!=0) cout << "Number is odd.\n";
else even (a);
}
void even(int a)
{
if ((a%2)==0) cout << "Number is even.\n";
else odd (a);
}
Arrays
// arrays example
#include <iostream>
using namespace std;
int main ()
{
int Integer[3];
cout<< "The Total Value of Integer 3 is: " << Integer[2] << "\n";
system("pause");
return 0;
}