INPUT's:
1) Name
2) Current date (month, day, year)
3) Birthday (month, day, year)

The output will be the person's age in years, months, and days. See example below:

Input name: shane

Input current date:
Month (1-12): 9
Day (1-31): 25
Year (yyyy): 2010

Input birthday:
Month (1-12): 9
Day (1-31): 4
Year (yyyy): 1978

shane, you are now 32 year(s), 0 month(s), and 21 day(s) old.

pls try

#include "stdio.h"
#include "conio.h"
int ay,yil,gun,a,y,g,guns,ays,yils;



main()
{
 a=9;    // todays month //
  g=27;  // todays day
  y=2010; // todays year
  printf("enter the day ");scanf("%d",&gun);
  printf("enter the month:");scanf("%d",&ay);
  printf("enter the year:");scanf("%d",&yil);
  if(gun>g) { 
    g=g+30;
    a=a-1;
    guns=g-gun;
  }
  else guns=g-gun;
  
  if(ay>a) { 
    a=a+12;
    y=y-1;a
    ays=a-ay;
  }
  else ays=a-ay;

  yils=y-yil;
  printf("day difference= %d   month difference=%d   year difference=%d",guns,ays,yils);
  getche();
  return 0;
}

pls try

#include "stdio.h"
#include "conio.h"
int ay,yil,gun,a,y,g,guns,ays,yils;



main()
{
 a=9;    // todays month //
  g=27;  // todays day
  y=2010; // todays year
  printf("enter the day ");scanf("%d",&gun);
  printf("enter the month:");scanf("%d",&ay);
  printf("enter the year:");scanf("%d",&yil);
  if(gun>g) { 
    g=g+30;
    a=a-1;
    guns=g-gun;
  }
  else guns=g-gun;
  
  if(ay>a) { 
    a=a+12;
    y=y-1;a
    ays=a-ay;
  }
  else ays=a-ay;

  yils=y-yil;
  printf("day difference= %d   month difference=%d   year difference=%d",guns,ays,yils);
  getche();
  return 0;
}

Wow you are such a clever person!

no I found this script in turkish website. it is not mine
I want to help usep
I am learning.

In the interests of getting the OP in trouble with his teacher for plagiarism:

#include <cctype>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <string>

namespace {
    const int MONTHS = 12;
    const int MONTH_NAME_MAX = 9;

    static const char *whitespace = " \t";
    static const char *separators = ".-/";

    static const char *months_full[] = {
        "january"  , "february", "march"   , "april",
        "may"      , "june"    , "july"    , "august",
        "september", "october" , "november", "december"
    };

    static const char *months_abbr[] = {
        "jan", "feb", "mar", "apr",
        "may", "jun", "jul", "aug",
        "sep", "oct", "nov", "dec"
    };

    int compare_insensitive(const char *a, const char *b)
    {
        int x, y;

        do {
            x = std::tolower((unsigned char)*a++);
            y = std::tolower((unsigned char)*b++);
        } while (x != '\0' && x == y);

        return (unsigned char)x - (unsigned char)y;
    }

    const char *skip_leading(const char *s, const char *match)
    {
        while (std::strchr(match, *s) != NULL) 
            ++s;

        return s;
    }

    const char *extract_name(const char *s, char *name, size_t limit)
    {
        /* Assume limit includes space for a null character */
        while (--limit > 0 && std::isalpha((unsigned char)*s)) 
            *name++ = (char)std::tolower((unsigned char)*s++);

        *name = '\0';

        return s;
    }

    bool extract_numeric(const char*& s, long& result)
    {
        char *end;

        if (!std::isdigit((unsigned char)*s)) 
            return false;

        errno = 0;
        result = std::strtol(s, &end, 10);

        if (errno) 
            return false;

        s = end;

        return true;
    }

    bool is_abbr_name(const char *name, bool validated)
    {
        bool result = validated;

        /* May is the only month the same abbreviated as not */
        if (compare_insensitive(name, "may") == 0) 
            return false;

        if (validated) 
            return true;

        for (std::size_t i = 0; i < MONTHS; i++) {
            if (compare_insensitive(name, months_abbr[i]) == 0) {
                result = true;
                break;
            }
        }

        return result;
    }

    bool is_valid_month(const char *name, long& month)
    {
        const char **months = months_full;
        bool result = false;

        if (std::strlen(name) == 3) 
            months = months_abbr;

        for (std::size_t i = 0; i < MONTHS; i++) {
            if (compare_insensitive(name, months[i]) == 0) {
                if (month != NULL) 
                    month = i + 1;

                result = true;
                break;
            }
        }

        return result;
    }

    bool is_valid_date(long year, long month, long day, std::tm*& result)
    {
        std::time_t date = std::time(NULL);
        std::tm *corrected = std::localtime(&date);

        if (year < 100) {
            /* Allow years without a century (assume the current one) */
            int century = ((int)((1900 + corrected->tm_year) / 100) * 100);

            year += century;

            if (year > 1900 + corrected->tm_year) {
                /* The assumption was probably wrong (future date); use the previous century */
                year -= 100;
            }
        }

        corrected->tm_year = year - 1900;
        corrected->tm_mon = month - 1;
        corrected->tm_mday = day;

        date = std::mktime(corrected);
        corrected = std::localtime(&date);

        /* Verify that the corrected date is the same as our desired date */
        if (date == (std::time_t)-1 ||
            corrected->tm_year != year - 1900 ||
            corrected->tm_mon != month - 1 ||
            corrected->tm_mday != day)
        {
            return false;
        }

        result = corrected;

        return true;
    }

    bool extract_month(const char*& s, long& month, char *name, std::size_t limit)
    {
        bool result = false;

        /* Check for a month name vs. month number */
        if (std::isdigit((unsigned char)*s)) 
            result = extract_numeric(s, month) && (0 < month && month <= MONTHS);
        else {
            s = extract_name(s, name, limit);
            result = !std::isalpha((unsigned char)*s) && is_valid_month(name, month);
        }

        return result;
    }

    /*
        Parse a date string according to <month> <day> <year> ordering
    */
    bool parse_mdy(const char *s, std::tm*& date)
    {
        char name[MONTH_NAME_MAX + 1] = {0};
        long month, day, year;
        char separator;

        s = skip_leading(s, whitespace);

        if (!extract_month(s, month, name, sizeof name))
            return false;

        /*
            If the month name is used, restrict separators to whitespace,
            otherwise restrict separation to *one* of the same character
        */
        if (name[0] != '\0') {
            /* Allow abbreviated names to end with a dot */
            if (*s == '.' && is_abbr_name(name, true)) 
                ++s;

            s = skip_leading(s, whitespace);
        }
        else if (std::strchr(separators, *s)) {
            separator = *s++;
        }

        if (!extract_numeric(s, day)) 
            return false;

        if (name[0] != '\0') {
            /* Allow a trailing comma on the day */
            if (*s == ',')
                ++s;

            s = skip_leading(s, whitespace);
        }
        else if (*s == separator) {
            ++s;
        }

        return extract_numeric(s, year) && is_valid_date(year, month, day, date);
    }
}

int main()
{
    std::string name;

    std::cout<<"Name: ";

    if (!getline(std::cin, name))
        return EXIT_FAILURE;

    std::string date;
    std::tm *tm_date;

    std::cout<<"Birthday: ";

    if (!getline(std::cin, date) || !parse_mdy(date.c_str(), tm_date))
        return EXIT_FAILURE;
    else {
        std::tm bday = *tm_date;
        std::time_t now = std::time(0);

        tm_date = std::localtime(&now);

        if (tm_date->tm_year == bday.tm_year &&
            tm_date->tm_mon == bday.tm_mon &&
            tm_date->tm_mday == bday.tm_mday)
        {
            std::cout<< name<<", you are 0 year(s), 0 month(s), and 0 day(s) old.\n";
        }
        else {
            tm_date->tm_mon -= bday.tm_mon;
            tm_date->tm_mday -= bday.tm_mday;

            now = std::mktime(tm_date);
            tm_date = std::localtime(&now);

            std::cout<< name <<", you are "
                     << tm_date->tm_year - bday.tm_year <<" year(s), "
                     << tm_date->tm_mon <<" month(s), and "
                     << tm_date->tm_mday <<" day(s) old.\n";
        }
    }

    return EXIT_SUCCESS;
}

See? This assignment was a piece of cake! I can't imagine how any beginner would have trouble with it. ;)

Structure declaration for Student info:
- name
- student id #
- program (course)
- year level
- # of courses (subjects)
- credits (units) for each course
- grade in each course
- weighted percentage average (wpa)

Sample run:
(If first time to run the program, create a text file named "1stSem_SY1011.txt")

No. of students: 0
Enter the following student information:
Name: Maui
ID #: 123
Program: BSCS
Year: 1
No. of courses: 3
Course 1: CS111
Credits: 3
Grade: 85
Course 2: Math 106
Credits: 6
Grade: 90
Course 3: PE 1
Credits: 2
Grade: 95

WPA: 89.54

No. of students: 1

Enter another (y/n)?


/*------------- WPA calculation ---------------- */
Credits x Grade
3 x 85 = 255
6 x 90 = 540
2 x 95 = 190
11 985

WPA: 985 / 11 = 89.54

/*----------------------------------------------------------*/

File format for 1stSem_SY1011.txt

Maui 123 BSCS 1
CS111 3 85
Math106 6 90
PE1 2 95
89.54

----------------------------------------------------
answers??

This article has been dead for over six months. Start a new discussion instead.