# help with repeatedly calling the user

• 09-29-2012
AlexTank853
help with repeatedly calling the user
Ok so here it is, The programs basic function is to calculate the estimated annual income of fast food industries after 2005 (any year, the user wants), i have all that done. however the program wants me to have it repeatedly ask the user to input, and this is giving me the hardest time how would i get the program to repeatedly call the function and stop
, any help would be gladley appreciated.
Code:

```#include <stdio.h> #include <math.h> int main(void) {         /* variables */     int t; /* amount of years between 2005 and the input year */     double F; /* formula for estimated annual income for fast food */     int year; /* year inputed by user */     int status; /* status value returned by user */     int error; /* error flag for bad input */     int skip_int; /* Skips the integer */                                     printf(" Please put any year after 2005 to estimate the annual income of fast food, note if any year is entered before 2005 this program will display an error and end the program");             scanf("%d", &year);                             if (year < 2005 )                     {                         printf("Invalid year program ending >>%d>>.", year);                                             }                 else if ( year >= 2005 )                     {                           t = year - 2005;                           F = 33.2 + (16.8 * t);                                                     printf("The estimated annual income in %d is expected to be %.2f Billion\n", year, F);                     }                       system("pause");             return (0);             }```
• 09-30-2012
qny
You need an infinite loop ... and a way to get out of it -- so it isn't really infinite :)

You can use any of the 3 loop constructs (I prefer the while)

Code:

```while (1) {     /* infinite stuff */     if (leave_loop) break;     /* infinite stuff */ }```
Code:

```for (;;) {     /* infinite stuff */     if (leave_loop) break;     /* infinite stuff */ }```
Code:

```do {     /* infinite stuff */     if (leave_loop) break;     /* infinite stuff */ } while (1);```