⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 travel14.c

📁 This is code tutorial for image processing include:histogram,sketon....
💻 C
📖 第 1 页 / 共 5 页
字号:
            printf("\nVia:______________________________");            for(i=0; i<30; i++) printf("\b");            gets(t->depart_via);            break;         case 5:            printf("\nARRIVAL");            get_mdy(&dummy);            t->arrive_date.month = dummy.month;            t->arrive_date.day   = dummy.day;            t->arrive_date.year  = dummy.year;            break;         case 6:            printf("\nArriving:______________________________");            for(i=0; i<30; i++) printf("\b");            gets(t->arrive_loc);            break;         case 7:            printf("\nAt:____ (24 hour time - no colon)");            for(i=0; i<30; i++) printf("\b");            gets(s);            t->arrive_time = atoi(s);            break;         case 8:            if(t->next == END_OF_LIST){               printf("\nNo more itinerarys");               not_finished = 0;            }  /* ends if END_OF_LIST */            else               t = t->next;            break;         case 9:            not_finished = 0;            break;         default:            printf("\n\nSorry, cannot understand your");            printf(" choice, try again.");            break;      }  /* ends switch choice */   }  /* ends while not_finished */}  /* ends edit_itinerary *//*****************************************************//*****************************************************//*PAGE edit_daily_expenses   This function allows the user to edit the   daily expenses.*/edit_daily_expenses(ds)   struct daily_struct *ds;{   char   r[L], s[L];   int    choice, j, not_done, not_finished = 1;   struct daily_struct *t;   struct MDY_struct    dummy;   t = ds;   while(not_finished){      printf("\n");      printf("\n\t1.  Today is: %2d-%2d-%2d",              t->today.month,              t->today.day,              t->today.year);      printf("\n\t2.  Maximum Lodging: $%8.2f",              dollars_of(t->max_lodging));      printf("\n\t3.  M&IE: $%8.2f",               dollars_of(t->mie));      printf("\n\t4.  Actual Lodging: $%8.2f",              dollars_of(t->actual_lodging));      printf("\n\t5.  POV Miles: %ld", t->pov_miles);      printf("\n\t6.  POV Description: %s",               t->pov_desc);      printf("\n\t7.  Rental Car Cost: $%8.2f",              dollars_of(t->rental_car));      printf("\n\t8.  Rental Car Description: %s",              t->rental_car_desc);      printf("\n\t9.  Taxi Cost: $%8.2f",              dollars_of(t->taxi));      printf("\n\t10. Taxi Description: %s ",              t->taxi_desc);      printf("\n\t11. Parking Cost: $%8.2f",              dollars_of(t->parking));      printf("\n\t12. Parking Description: %s",              t->parking_desc);      printf("\n\t13. Telephone Cost: $%8.2f",              dollars_of(t->phone));      printf("\n\t14. Telephone Description: %s",              t->phone_desc);      printf("\n\t15. Other Cost: $%8.2f",              dollars_of(t->other));      printf("\n\t16. Other Description: %s",              t->other_desc);      printf("\n\t17. Go on to the next day's expenses");      printf("\n\t18. Quit editing daily expenses");      printf("\n");      printf("\n\tEnter the number to change:__\b\b");      gets(r);      choice = atoi(r);      switch(choice){         case 1:            printf("\nEnter date:");            get_mdy(&dummy);            t->today.month = dummy.month;            t->today.day   = dummy.day;            t->today.year  = dummy.year;            break;         case 2:            printf("\nMax Lodging at TDY Point:_____\b\b\b\b\b");            t->max_lodging = get_money();            break;               case 3:            not_done = 1;            while(not_done){               printf("\nM&IE at TDY Point:_____\b\b\b\b\b");               t->mie = get_money();                     /* change - added 3 MIE values here                        4-15-93 - DP */               if(t->mie != MIE1  &&                  t->mie != MIE2  &&                  t->mie != MIE3  &&                  t->mie != MIE4  &&                  t->mie != MIE5){                  printf("\nMust equal");                  show_money(MIE1);                  printf(", ");                  show_money(MIE2);                  printf(", ");                  show_money(MIE3);                  printf(", ");                  show_money(MIE4);                  printf(", ");                  show_money(MIE5);               }  /* ends if MIE values */               else                  not_done = 0;            }  /* ends M&IE loop */            break;         case 4:            printf("\nActual Lodging:_____\b\b\b\b\b");            t->actual_lodging = get_money();            break;               case 5:            printf("\nPOV Miles:_____\b\b\b\b\b");            gets(s);            t->pov_miles = atoi(s);            break;         case 6:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->pov_desc);            break;         case 7:            printf("\nRental Car:______\b\b\b\b\b\b");            t->rental_car = get_money();            break;         case 8:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->rental_car_desc);            break;         case 9:            printf("\nTaxi:______\b\b\b\b\b\b");            t->taxi = get_money();            break;         case 10:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->taxi_desc);            break;         case 11:            printf("\nParking:______\b\b\b\b\b\b");            t->parking = get_money();            break;               case 12:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->parking_desc);            break;               case 13:            printf("\nOfficial Phone:______\b\b\b\b\b\b");            t->phone = get_money();            break;               case 14:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->phone_desc);            break;         case 15:            printf("\nOther:______\b\b\b\b\b\b");            t->other = get_money();            break;         case 16:            printf("\nDesc:______________________________");            for(j=0; j<30; j++) printf("\b");            gets(t->other_desc);            break;         case 17:            if(t->next == END_OF_LIST){               printf("\nNo more daily expenses");               not_finished = 0;            }  /* ends if END_OF_LIST */            else               t = t->next;            break;         case 18:            not_finished = 0;            break;         default:            printf("\n\nSorry, cannot understand your");            printf(" choice, try again.");            break;      }  /* ends switch choice */   }  /* ends while not_finished */}  /* ends edit_daily_expenses *//*****************************************************//*****************************************************//*PAGE edit_rental_expenses   This function allows the user to edit the   rental car personal use information.*/edit_rental_expenses(rs)   struct rental_struct *rs;{   char r[L], s[L];   int  choice, not_finished = 1;   long temp;   while(not_finished){      printf("\n\t1. Personal mileage is %ld",              rs->personal_mileage);      printf("\n\t2. Total mileage is %ld",             rs->total_mileage);      printf("\n\t3. Total gas is $%8.2f",             dollars_of(rs->total_gas));      printf("\n\n\tEnter number to make a change, 0 to quit");      printf("\n\t__\b\b");      gets(r);      choice = atoi(r);      switch(choice){         case 0:            not_finished = 0;            break;         case 1:            printf("\nPersonal Mileage:________\b\b\b\b\b\b\b\b");            gets(s);            rs->personal_mileage = atoi(s);            break;         case 2:            printf("\nTotal Rental Car Mileage:");            printf("________\b\b\b\b\b\b\b\b");            gets(s);            rs->total_mileage = atoi(s);            break;         case 3:            printf("\nTotal Gas:$________\b\b\b\b\b\b\b\b");            temp = get_money();            rs->total_gas = temp;            break;         default:            printf("\n\nSorry, cannot understand your ");            printf("choice, try again.");            break;      }  /* ends switch choice */   }  /* ends while not_finished */}  /* ends edit_rental_expenses *//*****************************************************//*****************************************************//*PAGE show_main_menu   This function shows the main menu on   the screen.*/show_main_menu(){   printf("\n");   printf("\n\tTravel Accounting System - CAC - ");   printf("Version 1.3 - April 1993");   printf("\n");   printf("\n1. Process new accounting");   printf("\n2. Review or print old accounting");   printf("\n");   printf("\n   Enter 0 to quit");   printf("\n\n");}  /* ends show_main_menu *//*****************************************************//*PAGE show_review_menu   This function shows the review menu on   the screen.*/show_review_menu(){   printf("\n");   printf("\nDo you want to review or change:");   printf("\n\t1. Traveller's name and ORN");   printf("\n\t2. Cash advance");   printf("\n\t3. GTR or Ticket advance amount");   printf("\n\t4. Transportation costs ");   printf("\n\t5. Itinerary");   printf("\n\t6. Daily expenses");   printf("\n\t7. Rental Car Personal Use");   printf("\n\t\tEnter 0 to quit");   printf("\n\n__\b\b");}  /* ends show_review_menu *//*****************************************************//*****************************************************//*PAGE get_mdy   Interact with the user to get the    month-day-year structure.*/get_mdy(a)   struct MDY_struct *a;{   char r[L];   printf("\nEnter month number:");   gets(r);   a->month = atoi(r);   if(a->month != -1){      printf("Enter day number:");      gets(r);      a->day = atoi(r);       printf("Enter year number (two digit):");      gets(r);      a->year = atoi(r);   }}  /* ends get_mdy *//*****************************************************//*****************************************************//*PAGE get_name   Interact with the user to get the    name of the traveller.*/get_name(a)   char a[];{   int i;   printf("\n\t\tName:______________________________");   for(i=0; i<30; i++) printf("\b");   gets(a);}  /* ends get_name *//*****************************************************//*****************************************************//*PAGE get_data_file_name        Use the name of the traveller and the        date to create a file name for the        data file.        If you are using a DOS system, the user        will enter the file name by hand.*/get_data_file_name(name, date_string, file_name)   char date_string[], file_name[], name[];{   char   s[L], s2[L];   FILE   *fp;   int    i, j, k, looking;   s2[0] = '\0';   if(UNIX_SYSTEM){        /* find first non-blank character in the name */      i=0;      while(name[i] == ' ')         i++;         /* copy non-blank characters from name */      j=0;      while(name[i] != '\0' &&            name[i] != '\n'){         if(name[i] == ' ')            file_name[j] = '.';         else            file_name[j] = name[i];         j++;         i++;      }            /* remove any extra periods */      while(file_name[j-1] == '.')         j--;      file_name[j++] = '.';      file_name[j]   = '\0';         strcat(file_name, date_string);         looking      = 1;      k            = 0;       strcpy(s2, file_name);         while(looking){         fp = fopen(s2, "rt");         if(fp == '\0')            looking = 0;         else{            fclose(fp);            sprintf(s, ".%d", ++k);            strcpy(s2, file_name);            strcat(s2, s);         }  /* ends else tried another name */      }  /* ends while looking */      strcpy(file_name, s2);   }  /* ends if UNIX_SYSTEM */   if(DOS_SYSTEM){      looking = 1;      while(looking){         printf("\n\nEnter the name of the file you");         printf("\nwant to use as the data file: ");         gets(s2);         fp = fopen(s2, "r");         if(fp == '\0')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -