About problem
- You have to write a program in C++ To print The current Date and Time In the output screen
- From this problem you have the knowledge about (ctime) header file and time_h (this is a predefined function and this function help us to show the current date and time in the output screen.
Coding
________________________________________________________________________________
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
time_t my_time =time(NULL);
cout<<ctime(&my_time);
}
_________________________________________________________________________________
OUTPUT
The given below is the desired output
Explanation of solution
- First of all add (iostream header file) after this we have to declared the time header file(ctime) for using the TIME functions in the program.
- Then start of main function , in the main function we use the (time_t) keyword for to display the current date and time .
- Then we use cout<< for displaying the current date and time .
Also check Out
Q-2) pointers in c
Q-3) Vector Sort
Also check Out Projects for Resume
Projects on C++
Projects on C
Problems On C
Q-1) Simple Calculator
Problems On C++
Q-2) Vectors In c++
THANK YOU !!!
- ---> And that is for this article friends hope all of you enjoy this
- article if still you have any doubts please comment below
- i will try to solve that .
Post a Comment
Post a Comment
Please do not spam in comment