Who am I?
I'm Luis. I'm a beginner in the photography field and a computer geek.
If you want to contact me you can send me an e-mail to lmurillo [at] codebeta [dot] net
Photos (view gallery)
Most Viewed
- Photos from the roof - 2,500 views
- Arepas Costarricenses - 78 views
- My first Bash script - 67 views
- Sanatorio Carlos Duran - 39 views
- Perfect Paper Passwords and SSH on Linux - 38 views
- 700mm lens and playground photos - 28 views
- Watermarking all the images - 18 views
- Adobe Lightroom 2 and other stuff - 16 views
- Volcan Irazu…the road trip - 12 views
- Oopps…that wasn’t supposed to happen… - 9 views
Recent Posts
- Scott Kelby’s Worldwide Photowalk August 19, 2008
- The door to the other side August 17, 2008
- Photos of the 50mm lens August 17, 2008
- Untitled August 16, 2008
- My mini-review of the 50mm f/1.8D lens August 15, 2008
Recent Comments
Categories
Codebeta Users
Personal
photography
Webcomic
Google Reader Shared
- Stuff We Can BuyThe Online Photographer Michael Johnston
- Japan Demands Probe of iPod Nano FlameoutsSlashdot kdawson
- Quantum Teleportationxkcd.com (author unknown)
- The WatcherThomas Hawk's Digital Connection noreply@blogger.com (Thomas Hawk)
- Photoshop 101: TEMPLATES.Pics and Kicks I'm Natalie.
- Judge Rules Man Cannot Be Forced To Decrypt HDSlashdot kdawson
- News: GDC2008 - Gears of War 2 PanelCtrl+Alt+Del tim@cad-comic.com (Tim)
- Otakon Applegeeks PanelHawk (author unknown)
- MIT Students' Gag Order LiftedSlashdot kdawson
- Get Started as a Pro - 6 TipsHyperphocal admin












Problems with std::cin
Well I was working on a code and I have a menu configured so the user can choose from the different options that there are. But apparently the program overlooks the std::getline() that go after that part :S
Well I was working on a code and I have a menu configured so the
user can choose from the different options that there are. But
apparently the program overlooks the std::getline() that go after that
part :S
Here is what I’m doing:
int main(int argc, char **argv)
{
unsigned int muiOption = 0;
std::string mszString;
…
do{
…
std::cout < < “Main Menu” << std::endl;
/*The options are included here*/
std::cout << “Option: “;
std::cin >> muiOption;
switch(muiOption){
case 1:
std::cout < < “Write a string of text: “;
std::getline(std::cin, mszString);
std::cout << “You typed: ” << mszString << std::endl;
break;
case 2:
…
}
}while(mszOption != 3);
return 0;
}
Now, when the user selects an option other than 3, the code simply
skips the std::getline() and it prints the std::cout that are there. So
the output looks like this:
so what could I be doing wrong? Can anyone tell me?
The code can be downloaded from http://lexington.opencurve.org/~lmurillo/p3.cpp
There are two required files, in case you want to compile the code:
http://lexington.opencurve.org/~lmurillo/lista.cpp
http://lexington.opencurve.org/~lmurillo/lista.h
[NOTE: Parts of the code are in spanish and other parts are in english]
-LMurillo