|
-
Great White Shark
basic C++ help
I am trying to write a Program that can Take an upper case and lower case State Aberviation and display the full name. Using a switch. Here is my code
// Jeff Flogerzi
// September 12
// CIS-17A
// HW_CHP4 State Abbreviations
#include <iostream>
using namespace std;
int main()
{
char state[2];
cout << "Please Enter one of the Following State Abbrevations:\n";
cout << "NC, SC, GA, FL, or AL.\n\n";
cin >> state;
switch(state)
{
case 'nc':
case 'NC':
cout << "The corresponsing State for the Abbreviation for NC is North Carolina\n";
break;
case 'SC':
case 'sc':
cout << "The corresponsing State for the Abbreviation for SC is South Carolina\n";
break;
case 'GA':
case 'ga':
cout << "The corresponsing State for the Abbreviation for GA is Georgia\n";
break;
case 'FL':
case 'fl':
cout << "The corresponsing State for the Abbreviation for FL is Florida\n";
break;
case 'AL':
case 'al':
cout << "The corresponsing State for the Abbreviation for AL is Alabama\n";
break;
default:
cout << "Input Error, Please enter NC,SC,GA,FL,AL.\n";
}
return 0;
}
Updated 12/27/05
A64 Desktop Rig
DC Opteron [email protected]
1GB UTT@245FSB 2/2/2/7
X1800XT 512MB @PE Speeds
19" Viewsonic WS LCD
2x160GB ATA HDs
NEC 3550 DL-DVD Burner
12.1 Ibook G3
256MB Ram
30GB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|