The program is pretty much done. It's a program to split an input such as 20110102 into 01/02/2011. I already have the loop in place, but for some reason when I output the program it gives me huge numbers. Please tell me what's wrong in my void function. Thank you.
Code:#include <iostream> #include <iomanip> using namespace std; void date (int fulldate, int month, int day, int year) { year = (fulldate/100/100); month = (fulldate0); day = ((fulldate/100)0); } int main() { rerun: int fulldate, month, day, year; char a; cout << "Enter a long integer of the form yyymmdd: "<< endl; cin >> fulldate; cout << "The date is " << month << "/" << day << "/" << year <<endl; cout << "Would you like to try again? [y/n]" << endl; cin >> a; if (a == 'y' || a == 'Y') goto rerun; else return 0; }



LinkBack URL
About LinkBacks


