Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

djrasa

@djrasa
About
Posts
12
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help with hangman controller.
    D djrasa

    Main.cpp #include <iostream> #include "Controller.h" //include controller header file using namespace std; int main() { int choice; //To hold screen to display message, until menu class is added. int menu = 0; const char *word = "Hangman"; Controller controller; Controller display; display.setmenu(menu); //Method to set the menu. display.getmenu(menu); //Method to get the menu. controller.setFilename(word); //Set filename to Hangman. cout << "Coming soon - " << controller.getFilename() << endl; //Display temporary message. cout << "To be continued......" << endl; cout << endl; cout << "Please click X in top right corner to exit." << endl; cin >> choice; //Hold screen to display message. return 0; }

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    Controller.cpp file #include "Controller.h" Controller::Controller() { Menu = 0; } int Controller::getmenu(int choice) { return Menu; } void Controller::setmenu(const int m) { Menu = m; } string Controller::getFilename() { return filename; } void Controller::setFilename(const char *s) { filename = s; }

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    in the controller class? something like this? class Controller { private: string filename; //Store filename. int Menu; //Store Menu. public: void setFilename(const char *s); //Method to set filename. string getFilename(void); //Method to get filename. int getmenu(int choice); //Method to get menu. void setmenu(const int m); //Method to set menu. Controller(); //Default constructor. }; #endif

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    call the function/method to display game board/word. This is what I have come up with so far, need to add variables to methods still. Is this close????? class Controller //Class for Controller. { public: void getgame(); void setgame (); Controller(); void getmenuinput(); void setmenuinput (); }; #endif //CONTROLLER_H

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    I guess my real question is what is the point of the controller class (what has to be in it)?? What actions of the menu, dictionary, and game will it(controller class) control (won't these classes control there own actions???) It seems to me that you would not need this class (if not for assignment). Sorry, thanks for the response, I am just having a hard time understanding this class (for the most part I understand the menu, game, and dictionary classes). Thanks again for being patient with me, and answering my questions.

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    I do not see how this will control the menu, dictionary, and game/ and no attributes (I am trying to understand, not trying to imply that it is incorrect{you would know before me : ) }). I thought that I needed two attributes (eg. int, char) and two functions for each to manipulate them. Sorry I am pretty new to this (retorical). Thank you for the fast response, much abliged.

    C / C++ / MFC tutorial c++ game-dev help question

  • Help with hangman controller.
    D djrasa

    I have to create a class called controller. I do not know what I need to include in this class: attributes and methods/getters/setters/operations?????? I understand the other classes involved in hangman, but not this one????? Demonstrate the use of a class. It is strongly recommended that you choose a class to implement from the Hangman Tutorial, such as the Controller class. Class must have a constructor. Class must have two class member variables of different data types and getters and setters to access these variables. Program must have 3 files, one header file, one .cpp file for that class and one Main.cpp. #ifndef CONTROLLER_H #define CONTROLLER _H #include <string> using namespace std; class Controller { private: string filename; // stores name of file where words are stored // Add other member variables here public: Controller(); void start(); // Add accessor and mutator methods here for your member values }; #endif // CONTROLLER_H Now add the source file (Controller.cpp) & code the constructor. #include "Controller.h" Controller::Controller(string filename) { cout << "Inside the Controller Default Constructor << endl; } // Finish implementing methods here First compile and execute the project to make sure you have typed everything correctly. Then modify your main() function to access your Controller class and use all methods. Here is an example main() function*: int main(int argc, char *argv[]) { Controller controller; // Call accessor and mutator methods for setting filename // Start the game return 0; } The Menu is not part of the actual hangman game itself, but rather allows us to add words to the game, play the game, and exit so it is a good candidate for its own class. The game itself can be a separate class so that we are not writing all of the code in main(). As a matter of a fact, let's plan on having very little code in main(), and let a separate class manage the interactions between the menu, game and the dictionary. We will call this class "Controller".

    C / C++ / MFC tutorial c++ game-dev help question

  • [Message Deleted] [modified]Sorry had to re-post
    D djrasa

    Thank you mark, could not of done it without you! ;P

    C / C++ / MFC

  • [Message Deleted] [modified]Sorry had to re-post
    D djrasa

    Thank You to all for the help. was not aware(obviously) of the ctrl-} tool. VERY, VERY, VERY, VERY HELPFUL :-D :laugh:

    C / C++ / MFC

  • [Message Deleted] [modified]Sorry had to re-post
    D djrasa

    Taking my first (C++) programming class and I can not get this to execute (if it is even possible) sorry for the long post and messy code, first time please take it easy on me, I am using visual studio 6. Thanks in advance. Please Help keep getting an error: fatal error C1075: end of file found before the left brace '{' at 'c:\users\dingleberry\documents\visual studio 2005\projects\practice3\practice3\p3.cpp(59)' was matched #include <iostream> #include <cmath> #include <fstream> #include <cstdlib> #include <iomanip> #include <math.h> #include <vector> #define rows 7 #define cols 3 using namespace std; int num; int input; int main() { char n[rows][cols]; ifstream indata; cout << "Guess Your Letter Game!!" << endl; cout << "Look at a letter write it down on scrap paper!!" << endl; cout << "Do not choose A or Z." << endl; indata.open("C:\\Users\\DingleBerry\\Documents\\chart.txt"); indata >> n[0][0] >> n[1][0] >> n[2][0]; indata >> n[3][0] >> n[4][0] >> n[5][0]; indata >> n[6][0] >> n[0][1] >> n[1][1]; indata >> n[2][1] >> n[3][1] >> n[4][1]; indata >> n[5][1] >> n[6][1] >> n[0][2]; indata >> n[1][2] >> n[2][2] >> n[3][2]; indata >> n[4][2] >> n[5][2] >> n[6][2]; cout << endl; cout << "Row1 Row2 Row3" << endl; cout << setw(3) << n[0][0] << setw(5) << n[1][0] << setw(6) << n[2][0] << endl; cout << setw(3) << n[3][0] << setw(5) << n[4][0] << setw(6) << n[5][0] << endl; cout << setw(3) << n[6][0] << setw(5) << n[0][1] << setw(6) << n[1][1] << endl; cout << setw(3) << n[2][1] << setw(5) << n[3][1] << setw(6) << n[4][1] << endl; cout << setw(3) << n[5][1] << setw(5) << n[6][1] << setw(6) << n[0][2] << endl; cout << setw(3) << n[1][2] << setw(5) << n[2][2] << setw(6) << n[3][2] << endl; cout << setw(3) << n[4][2] << setw(5) << n[5][2] << setw(6) << n[6][2] << endl; cout << endl; cout << "Which Row is you letter in?? : " << endl; cout << "Enter 1, 2, or 3 : "; cin &g

    C / C++ / MFC

  • [Message Deleted] [modified]Sorry had to re-post
    D djrasa

    may need to re-post

    C / C++ / MFC

  • [Message Deleted] [modified]Sorry had to re-post
    D djrasa

    had to repost sorry!!!

    modified on Friday, February 22, 2008 11:45 AM

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups