HELP!!! Stuck in a Loop.

Hi everyone;

I am new to C++ programming and wanted to write a program to tell the user his/her exact age as of todays' date right down to the years, months, and days.

After that is calculated, I want to compare his/her date of birth from mine, exactly like that above.

But I am stuck on a stupid IF() statement. Not to mention how I need to go forwards from there.

Here is my code so far...



#include <iostream>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <windows.h>

using namespace std;

int main()



{
int Name;
cout << "Enter your Name Please: " ;
cin >> Name;
cout << "/n";

time_t rawtime;
struct tm* timeinfo;

time( &rawtime );
timeinfo = localtime( &rawtime );
//
// Months January - December = 01 thru 12
//
const char* MONTHS[] =
{
"01", "02", "03", "04", "05", "06",
"07", "08", "09", "10", "11", "12"
};

cout << " Hello," << Name << " Today's date is "
<< timeinfo->tm_mday << " "
<< MONTHS[ timeinfo->tm_mon ] << " "
<< (timeinfo->tm_year + 1900) << ".\n";
cout << "" << endl;

// Here are the integers need for YourBirthdate and Age.

int YourBirthDay;
int YourBirthMonth;
int YourBirthYear;
int Your_Age;
// Here are the integers for My_Age.
int My_Age;
int My_BDay;
int My_BMonth;
int My_BYear;
My_BDay = 20;
My_BMonth = 04;
My_BYear = 1966;
//
//
int Age_Differance;
//
// Answer Integers.
//
int Yes, No;
int Y;
int N;
//
//
//
cout << "Enter the day you were born: (DD): ";
cin >> YourBirthDay;
cout << ".\n";
//
//
//
cout << "Enter the month you were born: (MM): ";
cin >> YourBirthMonth;
cout << ".\n";
//
//
//
cout << "Enter the year you were born: (YYYY): ";
cin >> YourBirthYear;
cout << ".\n";
//
//
//
//
cout << " Is This Input Date Correct ? : " << YourBirthDay <<"\t" << YourBirthMonth << "\t" << YourBirthYear << "\t";
cin>> Yes; No;
cout << ".\n";
if (Yes == Y);
cout << "Okay! Thak you!";
cout << ".\n";

else if (No == N);
cout << "Okay, Please Re-Enter Your Birthdate Information!!! ";
cout << ".\n";

else cout << "Man you are OLD!! :D Just Kidding!!! " ;
cout << "/n";
//
//
// Subtract todays date from user input to AGE of user in Years Months and Days old.
//
//
//
Your_Age = ();
cout << "You are actually " << Your_Age "/t" << "Years, Moths, Days Old !! ";
cout << "/n";
cout << "You really don't look that old! Do you??? " << endl;
cout << "/n";
//
// IF Statement here: Add or Subtract My_Age & Your_Age = Age_Difference for results.
//
cout << "You are:" << Age_Differance; << "/t" << "Years, Months, Days, Older Than Me.";
cout << "/n";
//
// IF Statement here: Add or Subtract My_Age & Your_Age = Age_Difference for results.
//
cout << "You are:" << Age_Differance; << "/t" << "Years, Months, Days, Younger Than Me.";
cout << "/n";










// cout << "Hello world!" << endl; */
return 0;
}


:

So can You Help ?? Any Ideas?
Please post the errors or give the line number of your problem.
Oh! and use code tags (<> button) not programme output.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cin>> Yes;
cout << ".\n";

if (Yes == 'Y')
{
	cout << "Okay! Thak you!";
	cout << ".\n";
}
else if (Yes == 'N')
{
	cout << "Okay, Please Re-Enter Your Birthdate Information!!! ";
	cout << ".\n";
}
else
{
	cout << "Man you are OLD!! :D Just Kidding!!! " ;
	cout << "/n";
}



Sorry, I don't have enough courage to read the rest of your code.

soli wrote:
Sorry, I don't have enough courage to read the rest of your code.

New to programming? Fell free! we all make some errors.
Quote: "To err is to human,..." by: Alexander Pope.

Hope it motivates you,
Aceix.
Topic archived. No new replies allowed.