Can anyone help me?
#include <iostream> using namespace std; int main () { cout << "When were you born? Ex. 2002(year) 6(month) 4(day)\n"; int yearborn; int monthborn; int dayborn; cin >> yearborn; cin >> monthborn; cin >> dayborn; cout << "What is the date today?\n"; int currentyear; int currentmonth; int currentday; cin >> currentyear; cin >> currentmonth; cin >> currentday; int ageyear; int agemonth; int ageday; ageyear = currentyear - yearborn; agemonth = currentmonth - monthborn; ageday = currentday - dayborn; if (agemonth == -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -12){ agemonth = ; } //This will not work! ^^ cout << "You are " << ageyear << " years old with " << agemonth << " months and " << ageday << " days."; return 0; } So this is supposed to tell you how old you are in years, months, and days. There is only one problem if your birthday is bigger than the date the end result will be a bunch of negative numbers. Your age cannot be negative. I need to figure out a way to make a negative number positive. For example, if(agemonth == -5) {agemonth = 5} The only problem with that is that I will have to write it 12 times. It will take too long. I want something more along the lines of if (agemonth = a negative number) {make it positive} Or something like this if (agemonth == -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -12){ agemonth = ; ^^ That won't work I can't really explain why but I think you can figure it out easily. Any ideas?