Hey, if anyone can help me, Im in an intro to C++ class, and I was having problems with writing a program that converts seconds to Y M D H Min Sec...and I have no idea where to start..can anyone help me???

Sec / 60 = min
min / 60 = hours
hour / 24 = days
days / 365 = years

So what did you try so far?

Niek

For example say you wanted to convert from minutes to hours, do something like this:

#include <iostream>
using namespace std;

int main()
{
    float minutes;
    
cout<<"Please enter the amount of minutes you would like to convert to hours: ";
cin>>minutes;

cout<<"That is "<<minutes / 60<<" hours"<<endl;
return 0;
}

Then from that code I gave you you can change the variables around and convert seconds to all of those

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.