Click here to Skip to main content
15,921,113 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cannot run my ADO program in Win 95 Pin
Toni7810-Apr-03 22:35
Toni7810-Apr-03 22:35 
GeneralRe: Cannot run my ADO program in Win 95 Pin
Zdeslav Vojkovic10-Apr-03 23:56
Zdeslav Vojkovic10-Apr-03 23:56 
GeneralRe: Cannot run my ADO program in Win 95 Pin
Toni7811-Apr-03 21:57
Toni7811-Apr-03 21:57 
GeneralRe: Cannot run my ADO program in Win 95 Pin
Zdeslav Vojkovic13-Apr-03 22:25
Zdeslav Vojkovic13-Apr-03 22:25 
GeneralNeed Help on Tab Ctrl Pin
kyoshiro9-Apr-03 19:44
kyoshiro9-Apr-03 19:44 
GeneralRe: Need Help on Tab Ctrl Pin
Cedric Moonen9-Apr-03 20:10
Cedric Moonen9-Apr-03 20:10 
GeneralRe: Need Help on Tab Ctrl Pin
Joan M9-Apr-03 20:44
professionalJoan M9-Apr-03 20:44 
GeneralSwitch statement and while loop Pin
Aaron Knox9-Apr-03 19:08
Aaron Knox9-Apr-03 19:08 
I'm trying to write a program that reads state abbreviations from an input file and then outputs the corrosponding state to an output file. (this is my first class in programming)

I'm using a while loop that runs until the end of input file and switch statements to match states and abbreviations, here is a portion...

<br />
inAbrev >> firstLetter >> secondLetter;  //splits abbreviation into two char's<br />
while(inAbrev)                           //read til the end of the file, inAbrev is the ifstream<br />
      {<br />
		  <br />
  switch (firstLetter)                   //checks first letter of abbreviation and tries to match it to working cases<br />
                                         //I have one of these for each letter that a state name begins with<br />
          {<br />
	  case 'A' : switch (secondLetter)<br />
				 {<br />
					case 'L' : outState << inAbrev << " is " << "Alabama" << endl; //outState is the <br />
						break;                                                 //output file<br />
					case 'K' : outState << inAbrev << " is " << "Alaska" << endl;<br />
						break;<br />
					case 'Z' : outState << inAbrev << " is " << "Arizona" << endl;<br />
						break;<br />
					case 'R' : outState << inAbrev << " is " << "Arkansas" << endl;<br />
						break;<br />
				 }<br />


I can get it to compile but my loop (and maybe my switch statements) seems to be wrong.
The problem is that it gets stuck on the first input (AL) and goes into an infinite loop of just reading that input,
it is never evaluated and nothing is output.

I'm probably missing something simple but my beginners brain can't find it.

Any help would be great.
Thanks,
Aaron

arrrgh
GeneralRe: Switch statement and while loop Pin
Joaquín M López Muñoz9-Apr-03 19:41
Joaquín M López Muñoz9-Apr-03 19:41 
GeneralRe: Switch statement and while loop Pin
Aaron Knox10-Apr-03 2:57
Aaron Knox10-Apr-03 2:57 
GeneralDate Time Picker problem Pin
rohit.dhamija9-Apr-03 18:25
rohit.dhamija9-Apr-03 18:25 
GeneralRe: Date Time Picker problem Pin
JohnJ9-Apr-03 19:44
JohnJ9-Apr-03 19:44 
GeneralProblem with SetWindowPos() function Pin
julia20009-Apr-03 17:34
julia20009-Apr-03 17:34 
GeneralRe: Problem with SetWindowPos() function Pin
Nish Nishant9-Apr-03 18:23
sitebuilderNish Nishant9-Apr-03 18:23 
GeneralRe: Problem with SetWindowPos() function Pin
julia20009-Apr-03 19:20
julia20009-Apr-03 19:20 
GeneralModifyStyle(......) Pin
ZarrinPour9-Apr-03 17:32
ZarrinPour9-Apr-03 17:32 
GeneralRe: ModifyStyle(......) Pin
Dave Bryant9-Apr-03 17:55
Dave Bryant9-Apr-03 17:55 
GeneralRe: ModifyStyle(......) Pin
Maximilien10-Apr-03 2:36
Maximilien10-Apr-03 2:36 
GeneralWM_RBUTTONDOWN message in dialog-based application Pin
Member 2592879-Apr-03 16:21
Member 2592879-Apr-03 16:21 
GeneralRe: WM_RBUTTONDOWN message in dialog-based application Pin
Nish Nishant9-Apr-03 17:25
sitebuilderNish Nishant9-Apr-03 17:25 
GeneralI have a problem about ID_FILE_SAVE and ID_FILE_PRINT Pin
-=JoKeR=-9-Apr-03 15:40
-=JoKeR=-9-Apr-03 15:40 
GeneralRe: I have a problem about ID_FILE_SAVE and ID_FILE_PRINT Pin
CodeBrain9-Apr-03 21:38
CodeBrain9-Apr-03 21:38 
GeneralNT Driver Pin
John R. Shaw9-Apr-03 13:52
John R. Shaw9-Apr-03 13:52 
GeneralRe: NT Driver Pin
geo_m10-Apr-03 5:07
geo_m10-Apr-03 5:07 
GeneralRe: NT Driver Pin
John R. Shaw10-Apr-03 8:44
John R. Shaw10-Apr-03 8:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.