Ok been messin with this code to try and better my understanding of c++, was hoping someone could help me out.
I commented in the code where i was specificly looking of help. Messed with it can't figure it out. Thanks in advance.
Code:
#include "stdafx.h"
#using <mscorlib.dll>
#include <tchar.h>
#include <stdlib.h>
#include <iostream>
#include <conio.h>
using namespace std;
using namespace System;
double intUsersAge();
double intCurDate();
void mShowAge(double, double);
int mfintQuitYN();
void mfBlank(int);
int _tmain()
{
double dlbUsersAge;
double dlbCurDate;
int intQuit;
dlbUsersAge = intUsersAge();
dlbCurDate = intCurDate();
do
{
system("CLS");
dlbUsersAge = intUsersAge();
dlbCurDate = intCurDate();
mShowAge(dlbUsersAge, dlbCurDate);
intQuit = mfintQuitYN();
}while (intQuit == 0);
return 0;
}
void mShowAge(double dlbUsersAge, double dlbCurDate)
{
cout << "You are " << dlbCurDate - dlbUsersAge << " Years Old as of today!\n";
cout << "\n";
if ((dlbCurDate - dlbUsersAge)>= 90)
{
cout << "\nYou getting pretty old there...\n";
}
if (dlbCurDate - dlbUsersAge >= 50 && dlbCurDate - dlbUsersAge <= 89)
{
cout << "Congrates, your middle aged...or alittle over\n";
cout << "\n";
cout << "You've outlived most others in third world countries....you must be proud\n";
}
if (dlbCurDate - dlbUsersAge >= 18 && dlbCurDate - dlbUsersAge <= 49)
{
cout << "Your in the prime of your life...lucky dog you\n";
}
if (dlbCurDate - dlbUsersAge >= 10 && dlbCurDate - dlbUsersAge <= 17)
{
cout << "The crystal ball says your body is changing and you\n";
cout << "be wantin yourself a car pretty soon.\n";
}
if (dlbCurDate - dlbUsersAge >= 1 && dlbCurDate - dlbUsersAge <= 9)
{
cout << "Learning to crawl, then walk, then ride your tri-cycle, gotsta love it.\n";
}
if (dlbCurDate - dlbUsersAge >= -100 && dlbCurDate - dlbUsersAge <= 0)
{
cout << "HOW ARE YOU HERE?!\n";
}
}
double intUsersAge()
{
double intAge;
Console::Write("Year you were born was? : ");
intAge = Convert::ToDouble(Console::ReadLine());
mfBlank(2);
return intAge;
}
double intCurDate()
{
double intAge;
Console::Write("Enter current Date Please : ");
intAge = Convert::ToDouble(Console::ReadLine());
mfBlank(2);
return intAge;
}
int mfintQuitYN() //<------HOW WOULD I MAKE THIS LOOP WITH A Y AND y INSTEAD OF 0. TRIED CONVERTING,
//BUT CAN'T DUE TO LOSS OF DATA. TRIED DECLARING DIFFERENTLY SUCH AS VOID...
//BUT NOT LUCK SO HELP IS NEEDED HERE.
//OH AND WOULD LIKE TO KEEP IT IN THIS DEFINED FUNCTION.
{
int intReturn;
mfBlank(2);
cout << "Enter 0 to Try Again or any other number to Quit: ";
cin >> intReturn;
return intReturn;
}
void mfBlank(int intBlank ) //ALSO HERE IF I TRY AND USE MFBLANK TO SPACE IN THE SHOWAGE FUNCTION, IT TELLS ME
//ITS UNDECLARED, BUT IT WORKS IN OTHERS, IS THAT SOMETHING
//SPECIAL ABOUT IF STATEMENTS?
{
int intCount = intBlank;
do
{
cout <<"\n";
intCount = intCount - 1;
} while (intCount > 0);
}