

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: INTRO COMPUTER PROG FOR ENGR; Subject: Computer Engineering; University: University of Alabama - Huntsville; Term: Unknown 1989;
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!
Electrical and Computer Engineering
1 of 12
i += 5; i = i + 5; pivotPoint *= n + 3; pivotPoint * (n + 3);
Electrical and Computer Engineering
2 of 12
Electrical and Computer Engineering
3 of 12
Electrical and Computer Engineering
4 of 12
Electrical and Computer Engineering 5 of 12
Electrical and Computer Engineering 6 of 12
enum Vowel {‘A’, ‘E’, ‘I’, ‘O’, ‘U’}; enum Places {1st, 2nd, 3rd}; enum Starch {CORN, RICE, POTATO, BEAN}; enum Grain {WHEAT, CORN, RYE, BARLEY, SORGHUM};
Electrical and Computer Engineering
7 of 12
enum Animals {RODENT, CAT, DOG, BIRD, REPTILE, HORSE,
BOVINE, SHEEP};
Animals inPatient; Animals outPatient;
inPatient = DOG; outPatient = inPatient; someInt = DOG; inPatient = Animals(inPatient + 1);
Electrical and Computer Engineering
8 of 12
switch (inPatient) { case RODENT : case CAT : case DOG : case BIRD : cout << “Cage ward”; break; case REPTILE : cout << “Terrarium ward”; break; case HORSE : case BOVINE : case SHEEP : cout “Barn”; break; }
Electrical and Computer Engineering
9 of 12
string animalName; cin >> animalName;
switch (toupper(animalName[0])) { case ‘R’ : if (toupper(animalName[1] == ‘O’) inPatient = RODENT; else inPatient = REPTILE; break; case ‘C’ : inpatient = CAT; break;. ..
Electrical and Computer Engineering
10 of 12
switch (inPatient) { case RODENT : cout << “Rodent”; break; case CAT : cout << “Cat”; break; case DOG : cout << “Dog”; break; case BIRD : cout << “Bird”;
. break; .. }
Electrical and Computer Engineering 11 of 12
Animals StrToAnimal (/in/ string str) { Animals inPatient; switch (toupper(str[0])) { case ‘R’ : if (toupper(animalName[1] == ‘O’) inPatient = RODENT; else inPatient = REPTILE; break; case ‘C’ : inPatient = CAT; break; case ‘D’ : inPatient = DOG; break; . . . return inPatient; } } Electrical and Computer Engineering 12 of 12