Example loop2

Example loop2 - Script started on Wed Feb 16 21:38:49 2005...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Script started on Wed Feb 16 21:38:49 2005 %cat c53loop.c #include<stdio.h> #define HOUSTON_COST 100.00 #define SAN_ANTONIO_COST 150.00 #define PHOENIX_COST 200.00 #define LOS_ANGELES_COST 300.00 int main(void) { int id, count, num_houston; char destin, class; float cost; double totcost; printf("*******************************************************************\n"); printf(" Fly by Night Airlines Passenger List\n"); printf("Id Destin Class Fare\n"); printf("*******************************************************************\n"); count = 0; totcost = 0.0; num_houston = 0; while (count < 5) { scanf("%d %c %c", &id, &destin, &class); printf("%d", id); if ('H' == destin || 'h' == destin) { printf(" Houston "); cost = HOUSTON_COST; num_houston++; } else if ('S' == destin || 's' == destin) { cost = SAN_ANTONIO_COST;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
printf(" San Antonio"); } else if ('L' == destin || 'l' == destin) { printf(" Los Angeles"); cost = LOS_ANGELES_COST; } else { cost = PHOENIX_COST; printf(" Phoenix "); } if ('f' == class || 'F' == class) {
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2011 for the course CSC 1253 taught by Professor Staff during the Fall '08 term at LSU.

Page1 / 3

Example loop2 - Script started on Wed Feb 16 21:38:49 2005...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online