• Advertisement

neshtak

Member
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

128 Neutral

About neshtak

  • Rank
    Member
  1. Need help with a small list program

    Yep. Thx man. Ill try to utilize these more often. ps yes that is the latest version of my code =)
  2. Hi. Basically I just finished reading about iterators, vectors and some of the basic algorithms. The excercise in the book is to write a little program that will allow user to store and maintain list of his/her favorite games. User should be able to display, add and remove the names in the list. The source: http://files.filefront.com/sourcetxt/;12291060;/fileinfo.html What my code does is add, and display, but can't remove from the list. I tried to understand why is this happening but no luck. Also when you type names with spaces the message "Enter: " turns into "Enter: Enter: " Where did i go wrong? ps Can you somehow make it so when user types in "r 'nameofthegameinthelist'" the program removes it, instead of my way?
  3. Need help to create a simple menu

    Whoah thanks, I got it now!
  4. Need help to create a simple menu

    Oh It worked nicely! Thanks man. But what does "myDifficulty = (difficulty)input;" means? [Edited by - neshtak on July 26, 2008 7:04:05 PM]
  5. Need help to create a simple menu

    Thanks man, but it didn't quiet worked out for me. When compiling in VC++ 9, I received this in Output-Build window: Quote: 1>------ Build started: Project: menuchooserenum, Configuration: Debug Win32 ------ 1>Compiling... 1>menuchooser.cpp 1>c:\documents and settings\ztein\my documents\visual studio 2008\projects\menuchooserenum\menuchooserenum\menuchooser.cpp(19) : error C2440: '=' : cannot convert from 'int' to 'difficulty' 1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast) 1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\menuchooserenum\menuchooserenum\Debug\BuildLog.htm" 1>menuchooserenum - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Almost! But 1 error is on the way. [Edited by - neshtak on July 26, 2008 7:48:35 PM]
  6. Hi. I'm having trouble with the following: "Rewrite the Menu Chooser program from this chapter using an enumeration to represent difficulty levels." The source: Download 1 The original "Menu Chooser" uses the switch() function with integer variable "choice", where it compares the cases with the inputted value stored in "choice". If there's a match, it outputs a corresponding message on the screen, if no match at all, the message "Invalid choice" pops up. But now I need to rewrite the program and use "enums" which will represent the difficulty levels. I tried figure out how would I program something like this, since Im not that strong with enums, and I kinda did but no luck - the VC++ 9 gives me an error. The source, with enums: Download 2 What am I doing wrong?
  7. Need help understanding Modulus

    Ok ;) Thanks for support!
  8. Need help understanding Modulus

    Oh ok I got it. So if the random number is say 848: 848 / 6 = 141.33333 Ignore everyhthing beyond "." 141 * 6 = 846 848 - 846 = 2 2 + 1 = 3 So the random number is 3. Thanks.
  9. Someone explain how it works. The only thing I know is that modulus arithmetic operator is represented as "%" Quote: #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { srand(time(0)); int randomNumber = rand(); int die = (randomNumber % 6) + 1; cout << "You rolled a " << die << endl; cin.ignore(cin.rdbuf()->in_avail() + 1); return 0; }
  10. C++ source code help

    Yea, I probably should start using VC++ Thanks for advices
  11. C++ source code help

    Oh... Thanks man, Gotta read more, haven't touched the array section yet.
  12. C++ source code help

    Hi. I've been learning C++, and made a little "game menu simulator" to test myself out. Everything worked fine and in order, until enums were added to the code. Firts they were embeded into the switch(), then I decided to make them global by moving enums outside the main(), but still no luck. Though theres less errors now. Can't figure out what's happening... The source code: Download I'm using Dev-C++
  • Advertisement