lab7 - beds++; cout << "moose" <<...

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

View Full Document Right Arrow Icon
#include <iostream> #include <string> using namespace std; int beds; int leaver; string person; int main(){ enum Status {TANNING, WAITING, ABSENT}; Status customer[26]; for (int i=0; i<26; i++) customer[i]=ABSENT; cin>> beds; cout << endl; while (beds!=0){ cin >> person; for (int n=0; n<person.length(); n++){ int value = person[n] - 'A'; if (customer[value]==ABSENT){ if (beds!=0){ customer[value]=TANNING; beds--; cout << beds << endl; } else customer[value]=WAITING; } if (beds==0){ if (customer[value]==TANNING){ customer[value]=ABSENT;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: beds++; cout << "moose" << endl; for (int j=0; j<26; j++){ if (customer[j]==WAITING){ customer[j]=TANNING; beds--; cout << "cow" << endl; } } } if (customer[value]==WAITING){ customer[value]=ABSENT; leaver++; cout <<leaver << endl; } } } if (leaver==0) cout << "All customers tanned successfully" << endl; else cout << leaver << " customer(s) walked away." << endl; for (int h=0; h<26; h++) customer[h]=ABSENT; int leaver=0; cin >> beds; } }...
View Full Document

This note was uploaded on 05/03/2011 for the course CSCI 180 taught by Professor Goldwasser,m during the Fall '08 term at Saint Louis.

Page1 / 2

lab7 - beds++; cout << "moose" <<...

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

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