Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUnder standing before driving your own class Pin
Zohaib Sibte Hassan9-Sep-04 20:02
Zohaib Sibte Hassan9-Sep-04 20:02 
QuestionHow do I Create a class with class wizard that derives from CObject? Pin
Ian Bowler9-Sep-04 19:46
Ian Bowler9-Sep-04 19:46 
AnswerRe: How do I Create a class with class wizard that derives from CObject? Pin
Arsalan Malik9-Sep-04 20:55
Arsalan Malik9-Sep-04 20:55 
GeneralRe: How do I Create a class with class wizard that derives from CObject? Pin
Ian Bowler10-Sep-04 6:46
Ian Bowler10-Sep-04 6:46 
Generalcom port settings using MFC Dialog Based Pin
anuchelvi9-Sep-04 18:57
anuchelvi9-Sep-04 18:57 
GeneralC Plus Plus Code Help Forums Pin
Texasgulfcoast9-Sep-04 18:01
sussTexasgulfcoast9-Sep-04 18:01 
GeneralRe: C Plus Plus Code Help Forums Pin
Cedric Moonen9-Sep-04 20:29
Cedric Moonen9-Sep-04 20:29 
Generalschool program =( Pin
ISUstudent9-Sep-04 17:21
ISUstudent9-Sep-04 17:21 
Hi, my name is jason

I am currently at a university takeing a c++ course and I AM SOOO LOST! =( I really could use some good adice from you guys!

Before I state my question, If anybody has AOL instant messenger my screen name is "imyoernme" and I would love to talk to u on it about my programs!!!!!! I would even consider using pay-pal to anybody who helps me succed in this class! You truely don' t understand HOW MUCH VALUE I CAN GET FROM YOU GUYS!

Ok...well here it goes.

This program that I am working on consists of the game "Connect four" It consits of three classes.

My first question is about our first class we are working on, its a MENU CLASS! This class is supposed to be a generic class and it should consist of nothing of the game. That is I can use this MENU class for other programs!

So far I have the menu.h and the menu.pp that I am working on!

Please can somebody help me!!! here are the directions for the menu class i got from my teacher.
___________________________________________________




[B]Menu class[/B]
Many programs use a menu to determine user choices. Your menu class should be generic, making it reusable in other programs you write.

Data Members:
an integer representing the number of choices on the menu
an array that can hold up to eight strings. Each string is one menu choice.

Methods (use the names given in bold and do not add any other methods):
a default constructor
a special constructor. The special constructor will take an int, indicating the number of choices in the menu, and eight strings. Each string will represent one menu choice. The last six strings will have default values of an empty string. This will allow the menu to handle from 2 to 8 menu choices.
run method to facilitate the menu processing and return the validated choice.
a helper method printMenu, and
a helper method validateChoice to read and validate the menu choice and return it.

Data Validation Requirements: Your menu should bring data in as characters, check that it is actually an integer within the expect range, convert it to an integer, and return an integer. See Technical Help for Program 2 for validation techniques





Here is my menu.cpp code...I don't know what to put for my validate choice desription!!! can anyone help? and the other empty ones!

#include <iostream>
#include <string>
#include "Menu.h"//includes Menu header file

//default constructor will initialize zero to the data private members (variables)

Menu::Menu()
{
numchoices = 0;

}

Menu::Menu(int c_numchoices, string str1, string str2, string str3, string str4,
string str5, string str6, string str7, string str8)
{

numchoices = c_numchoices;
MenuArr[0] = str1;
MenuArr[1] = str2;
MenuArr[2] = str3;
MenuArr[3] = str4;
MenuArr[4] = str5;
MenuArr[5] = str6;
MenuArr[6] = str7;
MenuArr[7] = str8;
}

int Menu::run()
{

printMenu();
validateChoice();

return choice;

}

void Menu::printMenu()
{
for(int i=0; i < numchoices; i++)//for loop
{
cout << i+1 << MenuArr[i] << endl;
}

}

int Menu::validateChoice()
{

char entry[1];
int choice;

do
{





}



PS...MY E-MAILL ADDRESS IS jdhooke@ilstu.edu Please e-mail for more help..that way I can connect with somebody and get through my class ....


Confused | :confused: Confused | :confused: Confused | :confused:
GeneralRe: school program =( Pin
Christian Graus9-Sep-04 17:37
protectorChristian Graus9-Sep-04 17:37 
GeneralRe: school program =( Pin
ISUstudent9-Sep-04 18:06
ISUstudent9-Sep-04 18:06 
GeneralRe: school program =( Pin
David Crow10-Sep-04 3:05
David Crow10-Sep-04 3:05 
GeneralRe: school program =( Pin
Anonymous10-Sep-04 22:24
Anonymous10-Sep-04 22:24 
GeneralRe: school program =( Pin
9-Sep-04 22:07
suss9-Sep-04 22:07 
GeneralRe: school program =( Pin
rotu9-Sep-04 22:26
rotu9-Sep-04 22:26 
GeneralRe: school program =( Pin
Mike Beckerleg9-Sep-04 23:50
Mike Beckerleg9-Sep-04 23:50 
GeneralRe: school program =( Pin
ISUstudent10-Sep-04 5:06
ISUstudent10-Sep-04 5:06 
GeneralMFC app doesn't work in debug mode, works in release mode Pin
Indrawati9-Sep-04 17:03
Indrawati9-Sep-04 17:03 
GeneralRe: MFC app doesn't work in debug mode, works in release mode Pin
Christian Graus9-Sep-04 17:38
protectorChristian Graus9-Sep-04 17:38 
GeneralReading a file using serialization Pin
hemanth_phk9-Sep-04 12:17
susshemanth_phk9-Sep-04 12:17 
GeneralRe: Reading a file using serialization Pin
David Crow10-Sep-04 3:15
David Crow10-Sep-04 3:15 
GeneralCan't open listening socket on Win2k3 Server Pin
Jon Betzold9-Sep-04 11:52
Jon Betzold9-Sep-04 11:52 
GeneralFigured it out Pin
Jon Betzold9-Sep-04 12:57
Jon Betzold9-Sep-04 12:57 
GeneralError - windows.h already included Pin
skg7479-Sep-04 11:49
skg7479-Sep-04 11:49 
GeneralRe: Error - windows.h already included Pin
Arsalan Malik9-Sep-04 19:32
Arsalan Malik9-Sep-04 19:32 
GeneralRe: Error - windows.h already included Pin
David Crow10-Sep-04 3:17
David Crow10-Sep-04 3:17 

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.