hello sir, i need a program in c++ i.e
A program in c++ that input your age,convert it to month,days,hours,minutes&seconds and print all these values on screen.
1
Expert's answer
2013-01-29T08:50:22-0500
#include <iostream> using namespace std;
int main () { cout<<"Enter your age, please (in seconds)\n"; long long s; cin>>s; int age = (s - (s % 31104000)) / 31104000; s = s % 31104000; int month = (s - (s % 2592000)) / 2592000; s = s % 2592000; int& days = (s - (s % 86400)) / 86400; s = s % 86400; int hour = (s - (s % 3600)) / 3600; s = s % 3600; int minutes = (s - (s % 60)) / 60; s = s % 60;
Comments
Leave a comment