Click here to Skip to main content
15,890,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: cin issues [modified] Pin
Harold_Wishes24-Jul-06 9:28
Harold_Wishes24-Jul-06 9:28 
GeneralRe: cin issues Pin
Harold_Wishes24-Jul-06 9:23
Harold_Wishes24-Jul-06 9:23 
GeneralRe: cin issues Pin
Zac Howland24-Jul-06 9:34
Zac Howland24-Jul-06 9:34 
GeneralRe: cin issues [modified] Pin
Harold_Wishes24-Jul-06 10:07
Harold_Wishes24-Jul-06 10:07 
GeneralRe: cin issues Pin
Zac Howland24-Jul-06 11:08
Zac Howland24-Jul-06 11:08 
GeneralRe: cin issues [modified] Pin
Harold_Wishes24-Jul-06 10:48
Harold_Wishes24-Jul-06 10:48 
GeneralRe: cin issues Pin
Zac Howland25-Jul-06 4:42
Zac Howland25-Jul-06 4:42 
QuestionRe: cin issues Pin
David Crow24-Jul-06 9:41
David Crow24-Jul-06 9:41 
Harold_Wishes wrote:
1) I want the user to be able to bypass keyboard entrys when they hit ENTER if they choose to skip a question. Now when I hit ENTER, the program will not let me go to the next cout prompt. It is waiting for something other than "\n" character. I believe this is why I used my getline implementation.


So what about something like:

do
{
    cin.clear();           // reset cin, so more input can be done
    cin.ignore(100, '\n'); // remove bad data, up to 100 characters
                           // or until the end of line is reached
    cout << "Please enter number of subunits: ";
    cin >> data;
} while (! cin && (data < 1 || data > 12));

Harold_Wishes wrote:
2)Also, if I type in something like "new terminal", such entrys delimited by a space seem to cause the next cin input to read in the second string. But I need to test the output some more with this second issue since I'm getting other strange results.


Then you would indeed need to use:

string buffer;
cout << "Please enter the length of the protein sequence for Subunit " << increment << "> ";
getline(cin, buffer);

QuestionDisplaying Multiple form in vc++ Pin
ningthemcha24-Jul-06 6:01
ningthemcha24-Jul-06 6:01 
AnswerRe: Displaying Multiple form in vc++ Pin
David Crow24-Jul-06 6:05
David Crow24-Jul-06 6:05 
QuestionVC++ 6.0 IDE mse.exe Pin
bob1697224-Jul-06 5:58
bob1697224-Jul-06 5:58 
AnswerRe: VC++ 6.0 IDE mse.exe Pin
bob1697224-Jul-06 6:03
bob1697224-Jul-06 6:03 
QuestionWindows NT 4.0 DDK download Pin
szilardcs24-Jul-06 5:07
szilardcs24-Jul-06 5:07 
AnswerRe: Windows NT 4.0 DDK download Pin
toxcct24-Jul-06 5:46
toxcct24-Jul-06 5:46 
QuestionError in loading DLL in Windows XP and WIndows 2003 Server Pin
BlrBoy24-Jul-06 4:44
BlrBoy24-Jul-06 4:44 
AnswerRe: Error in loading DLL in Windows XP and WIndows 2003 Server Pin
Mike Dimmick24-Jul-06 6:14
Mike Dimmick24-Jul-06 6:14 
QuestionImporting Makefile project to Visual Studio Pin
pgav24-Jul-06 4:21
pgav24-Jul-06 4:21 
QuestionRe: Importing Makefile project to Visual Studio Pin
David Crow24-Jul-06 4:57
David Crow24-Jul-06 4:57 
QuestionRe: Importing Makefile project to Visual Studio [modified] Pin
pgav24-Jul-06 5:19
pgav24-Jul-06 5:19 
AnswerRe: Importing Makefile project to Visual Studio Pin
David Crow24-Jul-06 5:48
David Crow24-Jul-06 5:48 
AnswerRe: Importing Makefile project to Visual Studio Pin
Mike Dimmick24-Jul-06 6:16
Mike Dimmick24-Jul-06 6:16 
QuestionMultiple dialog boxes Pin
alitokmen24-Jul-06 4:10
alitokmen24-Jul-06 4:10 
AnswerRe: Multiple dialog boxes Pin
Michael Dunn24-Jul-06 18:56
sitebuilderMichael Dunn24-Jul-06 18:56 
QuestionHow to use standard bitmaps in a toolbar Pin
Franken24-Jul-06 2:12
Franken24-Jul-06 2:12 
AnswerRe: How to use standard bitmaps in a toolbar Pin
kitty524-Jul-06 2:50
kitty524-Jul-06 2:50 

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.