Click here to Skip to main content
15,888,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
CPallini10-Dec-10 0:21
mveCPallini10-Dec-10 0:21 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Rajesh R Subramanian10-Dec-10 0:25
professionalRajesh R Subramanian10-Dec-10 0:25 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
CPallini10-Dec-10 0:23
mveCPallini10-Dec-10 0:23 
JokeRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Rajesh R Subramanian10-Dec-10 0:30
professionalRajesh R Subramanian10-Dec-10 0:30 
AnswerRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Gary R. Wheeler11-Dec-10 1:31
Gary R. Wheeler11-Dec-10 1:31 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
yccheok12-Dec-10 18:51
yccheok12-Dec-10 18:51 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Gary R. Wheeler13-Dec-10 11:45
Gary R. Wheeler13-Dec-10 11:45 
QuestionPassing Array To Function & Displaying Array Contents. Pin
Mike Certini9-Dec-10 18:41
Mike Certini9-Dec-10 18:41 
I am a newbie to C++ and am trying to pass an array to a function and then display the contents of this array through the function. The array is populated through a different function though both functions reside within the same class. I am struggling to figure out how to execute the function object to execute the display function. Listed below are all of the code components:

//=============================================
Monop.h
//Purchase Property Class
class PurchaseProperty
{
public:
void PropInit(void);
char Display();
char DisplayProp(char [],int);
private:
};

//=============================================
MonopFunct.cpp
#include <iostream>
#include "Monop.h"

using namespace std;
using std::cout;

void PurchaseProperty::PropInit()
{
char *PropNameArray[] = {"Mediterranean Avenue","Baltic Avenue","Oriental Avenue","Vermont Avenue","Connecticut Avenue","St. Charles Place","States Avenue",
"Virginia Avenue","St. James Place","Tennessee Avenue","New York Avenue","Kentucky Avenue","Indiana Avenue","Illinois Avenue",
"Atlantic Avenue","Ventnor Avenue","Marvin Gardens","Pacific Avenue","North Carolina Avenue","Pennsylvania Avenue","Park Place",
"Boardwalk"}; 

float PropCostArray[] = {60,60,100,100,120,140,140,160,180,180,200,220,220,240,260,260,280,300,300,320,350,400};

float PropRentArray[] = {2,4,6,6,8,10,10,12,14,14,16,18,18,20,22,22,22,26,26,28,35,50};

float PropRent1Array[] = {10,20,30,30,40,50,50,60,70,70,80,90,90,100,110,110,120,130,130,150,175,200};

float PropRent2Array[] = {30,60,90,90,100,150,150,180,200,200,220,250,250,300,330,330,360,390,390,450,500,600};

float PropRent3Array[] = {90,180,270,270,300,450,450,500,550,550,600,700,700,750,800,800,850,900,900,1000,1100,1400};

float PropRent4Array[] = {160,320,400,400,450,625,625,700,750,750,800,875,875,925,975,975,1025,1100,1100,1200,1300,1700};

float PropHotelRentArray[] = {250,450,550,550,600,750,750,900,950,950,1000,1050,1050,1100,1150,1150,1200,1275,1275,1400,1500,2000 };

float PropHouseCostArray[] = {50,50,50,50,50,100,100,100,100,100,100,150,150,150,150,150,150,200,200,200,200,200};

float PropHotelCostArray[] = {50,50,50,50,50,100,100,100,100,100,100,150,150,150,150,150,150,200,200,200,200,200};
};

char PurchaseProperty::Display()
{
int cnt;
for(cnt = 0; cnt < 22; cnt++)
{
cout << "Program is Working";
}
return 0;
}

char PurchaseProperty::DisplayProp(char PropNameArray[], int)
{
int cnt;
for(cnt = 0; cnt < 22; cnt++)
{
cout << PropNameArray[cnt];
}
return 0;
}

//=============================================
Main.cpp
#include <iostream>
#include "Monop.h"

using std::cout;
using std::cin;
using std::endl;

char DisplayProp(char PropNameArray[],int);

int main()
{

PurchaseProperty object;
object.PropInit();
object.DisplayProp(PropNameArray,22);

return 0;
} 

AnswerRe: Passing Array To Function & Displaying Array Contents. Pin
Cedric Moonen9-Dec-10 20:25
Cedric Moonen9-Dec-10 20:25 
GeneralRe: Passing Array To Function & Displaying Array Contents. Pin
Mike Certini10-Dec-10 8:10
Mike Certini10-Dec-10 8:10 
GeneralRe: Passing Array To Function & Displaying Array Contents. Pin
Stefan_Lang14-Dec-10 6:54
Stefan_Lang14-Dec-10 6:54 
AnswerRe: Passing Array To Function & Displaying Array Contents. Pin
Niklas L10-Dec-10 21:13
Niklas L10-Dec-10 21:13 
QuestionApplication crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 11:05
XTAL2569-Dec-10 11:05 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
mbue9-Dec-10 11:49
mbue9-Dec-10 11:49 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 12:19
sitebuilderLuc Pattyn9-Dec-10 12:19 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 13:11
XTAL2569-Dec-10 13:11 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 13:16
sitebuilderLuc Pattyn9-Dec-10 13:16 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 17:48
XTAL2569-Dec-10 17:48 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 22:47
sitebuilderLuc Pattyn9-Dec-10 22:47 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 23:21
XTAL2569-Dec-10 23:21 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Rajesh R Subramanian9-Dec-10 17:26
professionalRajesh R Subramanian9-Dec-10 17:26 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL25612-Dec-10 12:09
XTAL25612-Dec-10 12:09 
QuestionC Casting Problem Pin
Andy2029-Dec-10 8:14
Andy2029-Dec-10 8:14 
AnswerRe: C Casting Problem Pin
Luc Pattyn9-Dec-10 9:01
sitebuilderLuc Pattyn9-Dec-10 9:01 
GeneralRe: C Casting Problem Pin
Andy2029-Dec-10 10:41
Andy2029-Dec-10 10:41 

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.