please fix it for me guys!

hello , I am compeletly new in c++ I wrote program but I can`t run it I got several problems , please fix it for me. propuse of this program is that it give your bdate and count how many day did u lived until now, how many weeks did u lievd? what is your age, and in wich day of week did u bornd.
thans
// progeraam opgaven1
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
const int currentyear = 2015;

int GetDates(int year, int month, int day); //Functionprototype.
int year; //Declare variables
int month;
int day;
int dayOfWeek;
int jdn;
// current date
tm s;
time-t t;
time (&t);
s = * localtime (&t);
currentday = s.tm-mday;
currentmonth = s.tm-mon + 1;
currentyear = s.tmyear + 1900;
cout << "This progeram was created to find the Birth day and you age "
<< "created by Yaser kazemi (s1714341)" << endl;
//Get input from user
cout << "In wich year did u borned? (yyyy): ";
cin >> year;
//pprogeram should work for 150 years
if (currentyear - year < 0 || currentyear - year > 150) {
cout << "This year is out of range! Please enter a year " << endl;
return 1;
}
// check if user abvoe 10 and under 150 year is
if (currentyear - year < 10){
cout << "This progeram is not for you" << endl;
return 1;
}
if (currentyear - year > 100){
cout << "your are too old for this progeram" << endl;
return 1;
}
//Get the mothn and check it for condition
cout << "in which month did you bornd(1-12)? (mm)" << endl;
cin >> month;
if (month < 1 || month > 12) {
cout << "Invalid data! Please enter a month " << endl;
return 1;
}
if (currentyear - year == 10 && currentmonth - month < 0){
cout << "Come back next year" << endl;
retrun 1;
}
if (currentyear - year == 10 && currentmonth - month > 0){
cout << "Lets sleep,you are too old" << endl;
return 1;
}
// Get Bday and check it for condition
cout << "In wich day did you borned? day (dd): ";
cin >> day;
if ( day < 1 || day > 31){
cout << "Lets check the day agin" << endl;
returne 1;
}
switch (month){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if ( day > 31){
cout << "It is not a jok!,bye" << endl;
return 1;
}
break;
case 2:
if (year % 4 == 0){
if (day > 20 ){
cout << "It is not a jok!,bye" << endl;
return 1;
}
}
else{
if ( day > 28){
cout << "It is not a jok!,bye" << endl;
return 1;
}
}
break;
case 4:
case 6:
case 9:
case 11:
if (day > 30){
cout << "It is not a jok!, bye" << endl;
retrun 1;
}
break;
defult:
break;
}
if (currentyear - year == 10 && currentmonth - month == 0 &&
currentday - day < 0){
cout << "wait" << day - currentday << "days and try again" << endl;
return 0;
}
if (urrentyear - year == 100 && currentmonth - month == 0
&& currentday - day < 0){
cout << "you just pased the border for progeram " << endl;
return 1;
}
//days between 1-1-1901 and Bdate

difference = ( year - 1901) / 4 + Byear + Bday + mshift; // calculates day of the week
days = day - 1;
if (month > 1){
days = days + 31;
}
if (month > 2){
days = days + 28;
}
if (month > 3){
days = days + 31;
}
if (month > 4){
days = days + 30;
}
if (month > 5){
days = days + 31;
}
if (month > 6){
days = days + 30;
}
if (month > 7){
days = days + 31;
}
if (month > 8){
days = days + 31;
}
if (month > 9){
days = days + 30;
}
if (month > 10){
days = days + 31;
}
if (month > 11){
days = days + 30;
}
// calculate days
days = days + (( year - 1901) * 365) + ((year - 1900) / 4));
//calculate months
week = ((1 + days) % 7) + 1;
cout << "Untill today you lived for :" << days << endl;
cout << "Untill today you lived for :" << weeks << endl;
//day of week
if (dayOfWeek == 0){
cout << "The day of your Birth is : Mo" << endl;
break;
return 0;
}
else if (dayOfWeek == 1){
cout << "The day of your Birth is :Tu" << endl;
break;
return 0;
}
else if (dayOfWeek == 2){
cout << "The day of your Birth is :We" << endl;
break;
retunr 0;
}
else if (dayOfWeek == 3){
cout << "The day of your Birth is :Th" << endl;
break;
retunr 0;
}
else if (dayOfWeek == 4){
cout << "The day of your Birth is :Fr" << endl;
break;
retunr 0;
}
else if (dayOfWeek == 5){
cout << "Sa" << endl;
break;
retunr 0;
}
else if (dayOfWeek == 6){
cout << "Su" << endl;
break;
retunr 0;
}
return 0; // Terminates program.
}
This is a great question, but should most likely be moved into the beginners section or the general c++ programing that way more people will be able to help you out. Also, you should put all your code between [.code][/.code] to help people read your code. (I had to put the periods there but remove them when typing on the forum)
Last edited on
Did you write this code?
What do you mean by time - t t?
Why half of your variables are not declared with their type (int, float, double.. etc)?
Why the other half are not declared at all?
Why your variables are not written correctly within the code?
Why half of your "return" are written as "retrun" or "retunr"?
You can't use "break" within an if-statement, you can "break out the if" simply by breaking the condition.
Follow your syntax errors (The errors that the compiler is mentioning for you) and correct them. Then I guess you will be fine.
new update with allitle change
http://www.cplusplus.com/forum/beginner/174906/
Topic archived. No new replies allowed.