I'm on Windows 11. So, this program asks you to give a year. Then, when you give a year, it'll give you the GDP per capita figure for South Sudan for that year. Then, it'll ask you if you want to retry or leave. Then, when I give my decision, it'll either ask me for a year again or close the app. I find that when it's asking me to give a year, and I maximize my window, it'll just skip to whether I want to continue or leave. Then, when I maximize my window again, it'll go to asking me what year I want. How do I fix this?
Source code:
#include <stdio.h>
void main() {
int year;
int decision;
printf( "\nThis program tells the user what the GDP per capita of post-independence South Sudan was in a given year. The availability of a figure for a certain year is subject to the limitations of the data that was provided by the World Bank. " );
point_one :
printf( "Enter a year below to get a figure for that year.\n\n" ); // message one
scanf( "%d" , &year );
if(2011 > year || year > 2015 )
printf( "\nThe figure for that year is unavailable.\n" );
else if( year == 2011 )
printf( "\n1,516.40 USD\n" );
else if( year == 2012 )
printf( "\n1,179.40 USD\n" );
else if( year == 2013 )
printf( "\n1,779.47 USD\n" );
else if( year == 2014 )
printf( "\n1,322.82 USD\n" );
else if( year == 2015 )
printf( "\n1,119.65 USD\n" );
printf( "\nDo you want to try again or leave?\n\n" );
scanf ( "%d" , &decision );
if ( decision == 1 )
goto point_one;
else return;
}