Results 1 to 12 of 12

Thread: Apni Age calculate karen ** (Age calculator in c++)**

  1. #1
    Arslan-vu's Avatar
    Arslan-vu is offline Senior Member+
    Last Online
    2nd March 2018 @ 09:50 PM
    Join Date
    22 Mar 2013
    Gender
    Male
    Posts
    326
    Threads
    115
    Credits
    447
    Thanked
    88

    Default Apni Age calculate karen ** (Age calculator in c++)**

    #include <iostream>
    using namespace std;

    int main()
    {
    system("CLS");
    int byear, bmaand, bdag, hjaar, hmaand, hdag, ljaar, lmaand, ldag, tjaar, tmaand, tdag;
    char vraag1;
    cout << "\n\n\t\t__________ "" Age Calculator __________\n\n";
    cout << "\nIn which year where you born? (Example: 1995) ";
    cin >> byear;
    cout << endl << "In which month were you born? " << endl << endl;
    cout << " 1) January \n 2) February \n 3) March \n 4) April \n 5) May \n 6) June \n 7) July";
    cout << endl << " 8) August \n 9) September \n 10) October \n 11) November \n 12) December";
    cout << endl << endl << "Enter a value: ";
    cin >> bmaand;

    cout << endl << "On which day of the month were you born? ";
    cin >> bdag;
    if(bmaand == 1 || bmaand == 3 || bmaand == 5 || bmaand == 7 || bmaand == 8 || bmaand == 10 || bmaand == 12)
    {
    while(bdag <= 0 || bdag > 31)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of a month." << endl;
    cout << "Enter a valid value. 1 to 31 are valid values: ";
    cin >> bdag;
    }

    }
    if(bmaand == 4 || bmaand == 6 || bmaand == 9 || bmaand == 11)
    {
    while(bdag <= 0 || bdag > 30)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of a month." << endl;
    cout << "Enter a valid value. 1 to 30 are valid values: ";
    cin >> bdag;
    }

    }

    if(bmaand == 1)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th January " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 2)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th February " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 3)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th March " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 4)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th April " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 5)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th May " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 6)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th June " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 7)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th July " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 8)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th August " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 9)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th September " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 10)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th October " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 11)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th November " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    if(bmaand == 12)
    {
    system("CLS");
    cout << endl << "You were born on the " << bdag << "th December " << byear << "." << endl;
    cout << endl << "Is that right? (Y/N) ";
    cin >> vraag1;
    if(vraag1 != 'Y' && vraag1 != 'y')
    {
    cout << endl << "The program will be restarted so you can enter your ";
    cout << "data again." << endl << endl;
    system("pause");
    main();
    }
    }
    system("CLS");
    cout << endl << "Which year is it now? ";
    cin >> hjaar;

    cout << endl << "Which month is it now? " << endl << endl;
    cout << " 1) January \n 2) February \n 3) March \n 4) April \n 5) May \n 6) June \n 7) July";
    cout << endl << " 8) August \n 9) September \n 10) October \n 11) November \n 12) December";
    cout << endl << endl << "Enter a value: ";
    cin >> hmaand;


    cout << endl << "Which day of the month is it now? ";
    cin >> hdag;
    if(hmaand == 1 || hmaand == 3 || hmaand == 5 || hmaand == 7 || hmaand == 8 || hmaand == 10 || hmaand == 12)
    {

    }
    if(hmaand == 4 || hmaand == 6 || hmaand == 9 || hmaand == 11)
    {
    while(hdag <= 0 || hdag > 30)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of the month." << endl;
    cout << "1 to 30 are valid values. Enter a valid value: ";
    cin >> bdag;
    }

    }
    if(hmaand == 2)
    {
    if(hjaar%4 == 0)
    {
    if(hjaar%100 == 0 && hjaar%400 != 0)
    {
    while(hdag <= 0 || hdag > 28)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of the month." << endl;
    cout << "1 to 28 are valid values. Enter a valid value: ";
    cin >> bdag;
    }
    }
    else
    {
    while(hdag <= 0 || hdag > 29)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of the month." << endl;
    cout << "1 to 29 are valid values. Enter a valid value: ";
    cin >> bdag;
    }
    }
    }
    else
    {
    while(hdag <= 0 || hdag > 28)
    {
    system("CLS");
    cout << endl << bdag << " is an invalid value for a day of the month." << endl;
    cout << "1 to 28 are valid values. Enter a valid value: ";
    cin >> bdag;
    }
    }
    }
    if(hjaar == byear && hmaand == bmaand && hdag < bdag)
    {
    system("CLS");
    cout << endl << "You aren't born yet. This program is only intended for the people who are born." << endl;
    cout << "Just wait a few days, or enter a valid day: ";
    cin >> hdag;
    }
    cout << endl << "The system is calculating your age..." << endl << endl;
    ljaar = hjaar - byear;
    lmaand = hmaand - bmaand;
    ldag = hdag - bdag;
    if(lmaand < 0)
    {
    ljaar = ljaar - 1;
    lmaand = 12 + lmaand;
    }
    if(ldag < 0 && lmaand == 0)
    {
    ljaar = ljaar - 1;
    lmaand = 12 - 1;
    if(hmaand == 1 || hmaand == 3 || hmaand == 5 || hmaand == 7 || hmaand == 8 || hmaand == 10 || hmaand == 12)
    {
    ldag = 31 + ldag;
    }
    if(hmaand == 4 || hmaand == 6 || hmaand == 9 || hmaand == 11)
    {
    ldag = 30 + ldag;
    }
    if(hmaand == 2)
    {
    ldag = 28 + ldag;
    if(hjaar%4 == 0)
    {
    ldag = 29 + ldag;
    if(hjaar%100 == 0 && hjaar%400 != 0)
    {
    ldag = 28 + ldag;
    }
    }
    }
    }
    if(ldag < 0 && lmaand != 0)
    {
    lmaand = lmaand - 1;
    if(hmaand == 1 || hmaand == 3 || hmaand == 5 || hmaand == 7 || hmaand == 8 || hmaand == 10 || hmaand == 12)
    {
    ldag = 32 + ldag;
    }
    if(hmaand == 4 || hmaand == 6 || hmaand == 9 || hmaand == 11)
    {
    ldag = 31 + ldag;
    }
    if(hmaand == 2)
    {
    ldag = 29 + ldag;
    if(hjaar%4 == 0)
    {
    ldag = 30 + ldag;
    if(hjaar%100 == 0 && hjaar%400 != 0)
    {
    ldag = 29 + ldag;
    }
    }
    }
    }
    cout << "Birthyear: " << byear << endl;
    cout << "Birthmonth: " << bmaand << endl;
    cout << "Birthday: " << bdag << endl << endl;
    if(ldag != 1 && lmaand != 1)
    {
    cout << "You are " << ljaar << " years, " << lmaand << " months and " << ldag << " days old.";
    }
    if(ldag == 1 && lmaand == 1)
    {
    cout << "You are " << ljaar << " years, " << lmaand << " month and " << ldag << " day old.";
    }
    if(ldag != 1 && lmaand == 1)
    {
    cout << "You are " << ljaar << " years, " << lmaand << " month and " << ldag << " days old.";
    }
    if(ldag == 1 && lmaand != 1)
    {
    cout << "You are " << ljaar << " years, " << lmaand << " months and " << ldag << " day old.";
    }
    if(ljaar == 0 && lmaand == 0 && ldag == 0)
    {
    cout << endl << "You are just born!" << endl;
    }
    if(ljaar != 0 && lmaand == 0 && ldag == 0)
    {
    cout << endl << endl << "Happy birthday! You have become " << ljaar << " years old now!" << endl;
    }
    cout << endl << endl;

    system("pause");
    return 0;
    }
    Attached Images Attached Images  

  2. #2
    Arslan-vu's Avatar
    Arslan-vu is offline Senior Member+
    Last Online
    2nd March 2018 @ 09:50 PM
    Join Date
    22 Mar 2013
    Gender
    Male
    Posts
    326
    Threads
    115
    Credits
    447
    Thanked
    88

    Default

    compile this code in dev c++ compiler

  3. #3
    Join Date
    23 May 2013
    Gender
    Male
    Posts
    701
    Threads
    28
    Credits
    1,041
    Thanked
    58

    Default

    Yar Coding zra aik External file .txt me lga k btaya kroo aisay page ka load bhar jata hai..
    Expert In: PHP/MySQLi, Web Designing, SEO, Tips and Tricks, Wordpress, Social Networking, Programming.
    I hate ITD Moderators

  4. #4
    Net-Rider's Avatar
    Net-Rider is offline Advance Member+
    Last Online
    18th January 2014 @ 04:34 AM
    Join Date
    09 Jun 2009
    Location
    **PAKISTAN**
    Gender
    Male
    Posts
    28,932
    Threads
    1755
    Credits
    0
    Thanked
    6986

    Default

    moved to English Zone

  5. #5
    huzzefa is offline Junior Member
    Last Online
    3rd May 2014 @ 12:07 AM
    Join Date
    04 Oct 2013
    Gender
    Male
    Posts
    8
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    not working

  6. #6
    Arslan-vu's Avatar
    Arslan-vu is offline Senior Member+
    Last Online
    2nd March 2018 @ 09:50 PM
    Join Date
    22 Mar 2013
    Gender
    Male
    Posts
    326
    Threads
    115
    Credits
    447
    Thanked
    88

    Default

    Dear working fine hai mene screnshot b diay hain check it. use dev c++ compiler

  7. #7
    hajjnumrah is offline Junior Member
    Last Online
    14th October 2013 @ 03:39 PM
    Join Date
    05 Oct 2013
    Location
    london
    Age
    36
    Gender
    Male
    Posts
    18
    Threads
    2
    Credits
    0
    Thanked
    0

    Default

    not working

  8. #8
    farazarif22's Avatar
    farazarif22 is offline Senior Member+
    Last Online
    15th November 2014 @ 03:26 PM
    Join Date
    07 Oct 2013
    Location
    Lahore
    Gender
    Male
    Posts
    51
    Threads
    6
    Credits
    1,005
    Thanked
    4

    Default

    Your threads are very nice... thanx

  9. #9
    farazarif22's Avatar
    farazarif22 is offline Senior Member+
    Last Online
    15th November 2014 @ 03:26 PM
    Join Date
    07 Oct 2013
    Location
    Lahore
    Gender
    Male
    Posts
    51
    Threads
    6
    Credits
    1,005
    Thanked
    4

    Default

    Your threads are very nice... thanx

  10. #10
    winxp's Avatar
    winxp is offline Senior Member+
    Last Online
    22nd September 2019 @ 08:50 PM
    Join Date
    16 Apr 2010
    Location
    Peshawar- KPK
    Gender
    Male
    Posts
    126
    Threads
    28
    Credits
    7
    Thanked
    7

  11. #11
    SERIOUS is offline Member
    Last Online
    5th March 2014 @ 07:33 PM
    Join Date
    30 Sep 2012
    Location
    LAHORE
    Gender
    Male
    Posts
    2,001
    Threads
    310
    Thanked
    164

    Default

    JAZZaK ALLAH

  12. #12
    Join Date
    09 Apr 2009
    Location
    KARACHI&
    Gender
    Male
    Posts
    19,307
    Threads
    412
    Credits
    39,753
    Thanked
    1813

    Default

    بہت شکریہ برادر
    اس کی ایکزی فائل بنا کر بھی لوڈ کر دیتے
    تاکہ
    ممبرز کو زیادہ فائدہ ہوتا

Similar Threads

  1. apni website main stat tracker add karen
    By asad rafi in forum General Discussion
    Replies: 13
    Last Post: 30th June 2014, 03:58 PM
  2. apni tasveer ko picture message bana key send karen.
    By kamran virk in forum Nokia & Othre Mobiles
    Replies: 86
    Last Post: 28th May 2013, 05:22 PM
  3. Replies: 11
    Last Post: 4th May 2013, 05:43 PM
  4. Help! Mera ye thread zarur parhen aur apni rai de ker meri madad karen?
    By M UmarBh in forum Mobile phones problems and Help Zone
    Replies: 21
    Last Post: 15th November 2012, 09:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •