Wednesday, March 31, 2021

Date in Modern C++

 

Machine Problem In C++

Write a program that will accept dates written in the numerical form and then display them as a complete form. For example, the input:  6 8 1978 the output should be June 8, 1978. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com





Program Listing


// date.cpp

// Mr. Jake R. Pomperada, MAED-IT, MIT

// www.jakerpomperada.com /  www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental


#include <iostream>

#include <array>

#include <string>


const std::array<std::string, 13> month_names =

{

    "Dummy", "January", "February", "March", "April", "Mai", "June",

    "July", "August", "September", "October", "November", "December"

};


int main(int argc, char **argv)

{

    int day, month, year;

    std::cout <<"\n\n";

    std::cout << "\tDate in Modern C++";

    std::cout <<"\n\n";

    std::cout << "\tEnter day month year(seperated by whitespace) : ";

    std::cin >>  month >> day >> year;

    std::cout <<"\n\n";

    std::cout << "\tDate  : " <<month_names[month] << ' ' << day << ", " << year;

    std::cout <<"\n\n";

    std::cout << "\tEnd of Program";

    std::cout <<"\n\n";


}


No comments:

Post a Comment