Program po prostu musi obliczyć wiek użytkowników, odjęcie ich dob z bieżącego roku. Gdy uruchamiam program, ona pomyślnie skompilowany, ale mam długą liczbę, na przykład -215863352. Warunki if i else dodane tylko po to, aby je sprawdzić, pisałem różne programy, używać ich, aby upewnić się, że rozumiem składnia w c++. Rozumiem, że umyka coś prostego, ale nie mogę tego zrozumieć.
#include <stdio.h>
int main()
{
int year;
int cyear;
int age = cyear - year;
printf("Please enter the year you were born: \n");
scanf("%i", &year);
printf("Now enter the current year: \n");
scanf("%i", &cyear);
if (1+1 == 2){
printf("You must be %i", age);
}
else {
printf("Cannot compute age, GOODBYE:\n");
}
return 0;
}