C Program to Defines the entry point for the console application

How to write a C Program to Defines the entry point for the console application in C Programming Language ?


Solution:
/*Defines the entry point for the console application*/
//Defines the entry point for the console application.

#include "stdafx.h"
#include "time.h"


int _tmain(int argc, _TCHAR* argv[])
{
     
        char imie[20];
        char nazwisko[30];
        printf("Podaj imie: ");
        scanf("%s", &imie);
        printf("Podaj nazwisko: ");
        scanf("%s", &nazwisko);

   time_t czas_ms;
                time(&czas_ms);
                tm *data=localtime(&czas_ms);
                int rok=data->tm_year+1900;
                int miesiac=data->tm_mon+1;
                int dzien=data->tm_mday;

        int dzien_uro, miesiac_uro, rok_uro;
        printf("Podaj dzien urodzin : ");
        scanf("%d", &dzien_uro);
        printf("Podaj miesiac (w liczbie) : ");
        scanf("%d", &miesiac_uro);
        printf("Podaj rok urodzenia : ");
        scanf("%d", &rok_uro);


if(miesiac_uro >= 13){

printf("\nBLAD -Nie ma takiego miesiaca");
}
else if (miesiac_uro==1||miesiac_uro==3||miesiac_uro==5||miesiac_uro==7||miesiac_uro==8||miesiac_uro==10||miesiac_uro==12){
if(dzien_uro >=32){

printf("\nBLAD - Nie ma takiego dnia w tym miesiacu");
}
else
if (rok - rok_uro >= 18 && miesiac - miesiac_uro != 0 && dzien - dzien_uro != 0){

printf("\n%s %s gratulacje, jestes pelnoletni",&imie, &nazwisko);
}
else
printf("\n%s %s niestety, nie jestes pelnoletni", &imie, &nazwisko);
}
else if (miesiac_uro==2||miesiac_uro==4||miesiac_uro==6||miesiac_uro==9||miesiac_uro==11){
if(dzien_uro >=31){
printf("\nBLAD -Nie ma takiego dnia w tym miesiacu");
}
else
if (rok - rok_uro >= 18 && miesiac - miesiac_uro != 0 && dzien - dzien_uro != 0){

printf("\n%s %s gratulacje, jestes pelnoletni",&imie, &nazwisko);
}
else
printf("\n%s %s niestety, nie jestes pelnoletni", &imie, &nazwisko);

     
}

        getchar();
        getchar();
     
     
     
        return 0;
}


Learn More :