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

Sun Aug 01 18:16:33 2021




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

    click here

Projects on C++


Projects on C


Problems On C


Problems On 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 .






THANK YOU !!😀😀😀