I posted here about 2 weeks ago discussing what library I should use for my text based RPG game in c++ console development. I talked to my teacher about it, and he said that plagiarism was a huge concern, so I have to document nearly every aspect of my program to determine which part is that of another author or library's and which is my own. I deemed this too time consuming, so I decided to make a bare-bones c++ similar to:

http://www.daniweb.com/forums/thread5758.html

I used the same method for moving about rooms and using structures to declare certain attributes (still new to classes, so I skipped using them for now). I have several problems that I want to ask:

1] Anywho, in a certain function of my program, the Experience function, I have referenced the character structure. I set it so that each time you gain exp, it would check a list of requirements, and if all of those are met, a level up would occur. My problem is that when I compile, I keep getting the warning that the structure character (charman) is not initialized... how do I go about initializing it? I thought the general form was:
[structure name] [name for structure to be called in the function]
eg. character charman;

2] For my adventure function, I have set everything in a loop. However, when I try to run the game, after entering a choice once, the loop becomes infinite or something and doesn't stop. How should I go about fixing this? Shouldn't the loop also renew the prompt for entering a choice?

PS. I only posed part of the code here, since my code is about several pages long due to bad programming skills D: Thanks in advance for 'any' help (hopefully I get some this time).

//	Summative Project: Fail Quest
//	Anonymous
//	May 23rd, 2008

#include "Global Stats.h"

void main()

{
	srand (time(NULL));
	init_graphics();

	int choice;

	//	Title Screen
title:

	set_color (cCYAN, cBLACK);
	set_cursor_pos (52,5);

	cout<< "Fail Quest";
	cout.flush();

	set_cursor_pos (51,7);
	cout<< "Version: 1.0";
	cout.flush();

	wait (500);

	set_cursor_pos (50,10);
	cout<< "1.	NEW GAME";
	cout.flush();

	set_cursor_pos (50,12);
	cout<< "2.	CONTINUE";
	cout.flush();

	set_cursor_pos (50,14);
	cout<< "3.	EXIT";
	cout.flush();

	set_cursor_pos (49,16);
	cout<< " MAKE YOUR CHOICE: ";
	cout.flush();

	choice= cin.get();
	cin.width (2);
	cin.ignore (50, '\n');

	switch (choice)
	{
	case '1':
		generate_character();
		generate_adventure();

		break;

	case '2':

	break;

	case '3':
		set_cursor_pos (31,20);
		set_color (cRED,cBLACK);
		cout<< "Thankyou for trying the trial version of Fail RPG!";
		cout.flush();

		set_cursor_pos (31,21);
		wait (500);
		return;

	default:
		set_cursor_pos (31,20);
		set_color (cMAGENTA,cBLACK);
		cout<< "INVALID CHOICE";
		cout.flush();
		
		wait (1000);
		break;
	}

	clear_screen();
	goto title;

	return;
}

void experience()
{
	character character;

	if (character.exp>= 20 && character.exp< 50 && character.level==1)
	{
		//	Adds randomized status bonuses
		character.strength= character.strength+ (rand()%2+1);
		character.defense= character.defense+ (rand()%2+1);
		character.speed= character.speed+ (rand()%2+1);
		character.maxhp= character.maxhp+ (rand()%4+1);
		character.maxsp= character.maxsp+ (rand()%2+1);

		//	Restores Spirit Points and Health
		character.hp= character.maxhp;
		character.sp= character.maxsp;

		//	Changing the Level
		character.level= 2;
	}

	else if (character.exp>= 50 && character.exp< 90 && character.level==2)
	{
		//	Adds randomized status bonuses
		character.strength= character.strength+ (rand()%2+1);
		character.defense= character.defense+ (rand()%2+1);
		character.speed= character.speed+ (rand()%2+1);
		character.maxhp= character.maxhp+ (rand()%5+1);
		character.maxsp= character.maxsp+ (rand()%3+1);

		//	Restores Spirit Points and Health
		character.hp= character.maxhp;
		character.sp= character.maxsp;

		//	Changing the Level
		character.level= 3;
	}

	else if (character.exp>= 90 && character.exp< 140 && character.level==3)
	{
		//	Adds randomized status bonuses
		character.strength= character.strength+ (rand()%3+1);
		character.defense= character.defense+ (rand()%3+1);
		character.speed= character.speed+ (rand()%3+1);
		character.maxhp= character.maxhp+ (rand()%5+1);
		character.maxsp= character.maxsp+ (rand()%3+1);

		//	Restores Spirit Points and Health
		character.hp= character.maxhp;
		character.sp= character.maxsp;

		//	Changing the Level
		character.level= 3;	
	}

	else if (character.exp>= 140 && character.exp< 200 && character.level==3)
	{
		//	Adds randomized status bonuses
		character.strength= character.strength+ (rand()%3+1);
		character.defense= character.defense+ (rand()%3+1);
		character.speed= character.speed+ (rand()%3+1);
		character.maxhp= character.maxhp+ (rand()%6+1);
		character.maxsp= character.maxsp+ (rand()%8+1);

		//	Restores Spirit Points and Health
		character.hp= character.maxhp;
		character.sp= character.maxsp;

		//	Changing the Level
		character.level= 4;	
	}

	else if (character.exp>= 200 && character.exp<280 && character.level==4)
	{
		//	Adds randomized status bonuses
		character.strength= character.strength+ (rand()%3+1);
		character.defense= character.defense+ (rand()%3+1);
		character.speed= character.speed+ (rand()%3+1);
		character.maxhp= character.maxhp+ (rand()%6+1);
		character.maxsp= character.maxsp+ (rand()%8+1);

		//	Restores Spirit Points and Health
		character.hp= character.maxhp;
		character.sp= character.maxsp;

		//	Changing the Level
		character.level= 5;
	}
}
//********************************************************************************************

void generate_character()
{
	//	Referencing Structures / Variables --------------------------------
	int stat=5;
	int choice;
	char choice2;
	character charman;

	//	Drawing the Screen ------------------------------------------------
	clear_screen();

	set_color(cGREEN,cBLACK);
	set_cursor_pos (1,2);
	cout<< "********************************************************************************";
	cout.flush();

	set_cursor_pos (1,25);
	cout<< "********************************************************************************";
	cout.flush();

	set_color (cCYAN,cBLACK);
	set_cursor_pos (2,2);

	cout<< "GENERATE A CHARACTER";
	cout.flush();

	set_color (cWHITE,cBLACK);
	
	set_color (cDARK_GRAY,cBLACK);
	set_cursor_pos (2,5);
	cout<< "Welcome to the world of Tyria stranger...";
	cout.flush();
	wait (500);

	set_color (cLIGHT_GRAY,cBLACK);
	set_cursor_pos (2,5);
	cout<< "Welcome to the world of Tyria stranger...";
	cout.flush();
	wait (500);

	set_color (cWHITE,cBLACK);
	set_cursor_pos (2,5);
	cout<< "Welcome to the world of Tyria stranger...";
	cout.flush();
	wait (1000);

	set_cursor_pos (2,7);
	cout<< "It seems as if you have come to this world by an unforseen accident.  I have \nbeen watching you for a long time.";
	cout.flush();

	cout<< " This world is much different from yours, I \nshould advise you to forget everything that you know of modern society, for \nyour knowledge will only hinder you in your upcoming trials.";
	cout.flush();

	cout<< " What trials you \nsay?  You shall find out soon enough... in fact, with me acting as your guide, \nyou will realize your true potential within a short amount of time.";
	cout.flush();

	set_cursor_pos (2,13);
	cout<< "\nNow tell me, what is your name stranger?";
	cout.flush();

	//	Getting character name --------------------------------------------
	set_cursor_pos (2,15);
	set_color (cGREEN,cBLACK);
	cin.getline (charman.classman, 10, '\n');

stat:
	clear_screen();

	set_color(cGREEN,cBLACK);
	set_cursor_pos (1,2);
	cout<< "********************************************************************************";
	cout.flush();

	set_cursor_pos (1,25);
	cout<< "********************************************************************************";
	cout.flush();

	set_color (cCYAN,cBLACK);
	set_cursor_pos (2,2);

	//	Distributing status abilities -------------------------------------
	cout<< "GENERATE A CHARACTER: ATTRIBUTES";
	cout.flush();

	set_color (cWHITE,cBLACK);
	set_cursor_pos (2,5);

	cout<< "Excellent "<< charman.classman<< ", now please tell me the attributes that define who you are.";
	cout.flush();

	cout<< "\nYou have a certain number of status points that you may distribute across your \nstrengths...";
	cout.flush();

	//	Setting initial status before modification
	charman.maxhp= 60;
	charman.maxsp= 20;
	charman.hp= 60;
	charman.sp= 20;
	charman.strength=2;
	charman.defense=2;
	charman.speed=1;
	charman.magic=1;
	charman.stat= true;

	do
	{
		set_cursor_pos (12,9);
		cout<< "You have: ";
		cout.flush();

		set_color (cGREEN,cBLACK);
		cout<< stat<< " left to spend.";
		cout.flush();

		set_cursor_pos (10,11);
		set_color (cWHITE,cBLACK);
		cout<< "1.	Strength: "<< charman.strength;
		cout.flush();

		set_cursor_pos (10,12);
		cout<< "2.	Defense: "<< charman.defense;
		cout.flush();

		set_cursor_pos (10,13);
		cout<< "3.	Speed: "<< charman.speed;
		cout.flush();

		set_cursor_pos (10,14);
		cout<< "4.	Magic: "<< charman.magic;
		cout.flush();

		set_cursor_pos (10,16);
		cout<< "Enter your choice: ";
		cout.flush();

		choice= getche();

		//	Adds +1 to each stat depending on choice ----------------------
		switch (choice)
		{
		case '1':
			charman.strength= (charman.strength) + 1;
			stat= stat-1;

			set_cursor_pos (12,9);
			cout<< "You have: ";
			cout.flush();

			set_color (cGREEN,cBLACK);
			cout<< stat<< " left to spend.";
			cout.flush();
			break;

		case '2':
			charman.defense= (charman.defense) + 1;
			stat= stat-1;

			set_cursor_pos (12,9);
			cout<< "You have: ";
			cout.flush();

			set_color (cGREEN,cBLACK);
			cout<< stat<< " left to spend.";
			cout.flush();
			break;

		case '3':
			charman.speed= (charman.speed) + 1;
			stat= stat-1;

			set_cursor_pos (12,9);
			cout<< "You have: ";
			cout.flush();

			set_color (cGREEN,cBLACK);
			cout<< stat<< " left to spend.";
			cout.flush();
			break;

		case '4':
			charman.magic= (charman.magic) + 1;
			stat= stat-1;

			set_cursor_pos (12,9);
			cout<< "You have: ";
			cout.flush();

			set_color (cGREEN,cBLACK);
			cout<< stat<< " left to spend.";
			cout.flush();
			break;

		default:
			set_cursor_pos (10,18);
			set_color (cMAGENTA,cBLACK);
			cout<< "Invalid Choice, Try Again";
			cout.flush();

			wait (1000);

			set_cursor_pos (10,18);
			set_color (cBLACK,cBLACK);
			cout<< "                          ";
			cout.flush();
			break;
		}
	} while (stat!=0);

	//	Checking to see if user wants these stats -------------------------
	set_cursor_pos (10,16);
	cout<< "Are these changes sufficient "<< charman.classman<< "? (Y/N) ";
	cout.flush();

	cin>> choice2;
	cin.width (1);
	cin.ignore (50, '\n');

	if (choice2!= 'y' && choice2!= 'Y')
	{
		stat=5;
		goto stat;
	}

	//	Final Screen ------------------------------------------------------
	clear_screen();

	set_color(cGREEN,cBLACK);
	set_cursor_pos (1,2);
	cout<< "********************************************************************************";
	cout.flush();

	set_cursor_pos (1,25);
	cout<< "********************************************************************************";
	cout.flush();
	
	set_color (cCYAN,cBLACK);
	set_cursor_pos (2,2);
	cout<< "GENERATE A CHARACTER";
	cout.flush();

	set_color (cWHITE,cBLACK);
	set_cursor_pos (3,5);
	cout<< "Excellent "<< charman.classman<< ", you will now begin your journey in the world of Tyria.";
	cout.flush();

	cout<< "\nYou will face many hazardous trials ahead, but I have faith that you will \nperservere in the end.";
	cout.flush();

	cout<< " Do not worry, I will be with you on your journey, whether \nyou can see me or not.  Finally, here is one piece of advice: ";
	cout.flush();

	set_cursor_pos (10,10);
	set_color (cDARK_GRAY,cBLACK);
	cout<< "\nMemento Mori...";
	cout.flush();
	wait (1000);

	set_cursor_pos (10,10);
	set_color (cDARK_GREEN,cBLACK);
	cout<< "\nMemento Mori...";
	cout.flush();
	wait (1000);

	set_cursor_pos (10,10);
	set_color (cGREEN,cBLACK);
	cout<< "\nMemento Mori...";
	cout.flush();

	set_color (cGREEN,cBLACK);
	set_cursor_pos (11,12);
	cout<< "\nMemento Mori...";
	cout.flush();

	return;
}
//********************************************************************************************

void generate_adventure()
{
	//	Setting initial room to 0 generating rooms ----------------------------
	int currentroom=0;
	int roomsearch;
	int choices;
	character charman;
	charman.hp=50;

	generate_room();

	do
	{
		clear_screen();

		set_color (cGREEN,cBLACK);
		set_cursor_pos (1,12);
		cout<< "********************************************************************************";
		cout.flush();

		//	Displaying Room and Room Description ------------------------------
		set_color (cWHITE,cBLACK);
		set_cursor_pos (2,13);
		cout<< "You have come to "<< roomarray[currentroom].name<< ".";
		cout.flush();

		set_cursor_pos (1,14);
		cout<< roomarray[currentroom].description;
		cout.flush();

		//	Room Defaults, if a direction is -1, you can't move there! --------
		if (roomarray[currentroom].north!= -1)
		{
			set_cursor_pos (2,20);
			cout<< "[N]orth";
			cout.flush();
		}

		if (roomarray[currentroom].east!= -1)
		{
			set_cursor_pos (8,20);
			cout<< "[E]ast";
			cout.flush();
		}

		if (roomarray[currentroom].west!= -1)
		{
			set_cursor_pos (14,20);
			cout<< "[W]est";
			cout.flush();
		}

		if (roomarray[currentroom].south!= -1)
		{
			set_cursor_pos (20,20);
			cout<< "[S]outh";
			cout.flush();
		}

		set_color (cGREEN,cBLACK);
		set_cursor_pos (2,21);
		cout<< "Please choose a direction to move:\nPress 'e' to exit the game, Press 'c' to check character stats, Press 's' to search the area: ";
		cout.flush();

		//	Shows character stats ---------------------------------------------
		cin>> choices;
		cin.width (1);
		cin.ignore (50, '\n');

		switch (choices)
		{
		case 'c':
			character_man();
			break;

		case 'e':
			game_overnow();
			return;

		case 's':
			roomsearch= (rand()%5+1);
			
			if (roomsearch==1)
			{
				battle_intro();
				generate_battle();
			}

			else if (roomsearch==2)
			{
				set_cursor_pos (2,18);
				cout<< "You have found nothing in the room.";
				cout.flush();
			}
		}
		
		//	The room becomes the one chosen on next loop-through based on choice
		if (choices== 'e')
		{
			currentroom= roomarray[currentroom].east;
		}

		if (choices== 'w')
		{
			currentroom= roomarray[currentroom].west;
		}

		if (choices== 's')
		{
			currentroom= roomarray[currentroom].south;
		}

		if (choices== 'n')
		{
			currentroom= roomarray[currentroom].north;
		}

	} while (charman.hp>0);

	return;
}//*******************************************************************************************

void generate_room()
{
	//	Each room has 4 different integer variables, each one corresponding to a direction that the user may travel.
	strcpy (roomarray[0].name, "the Courtyard");
	strcpy (roomarray[0].description, "You look around you to find yourself in a huge courtyard.  Not surpringsingly, the area is kept in near perfect condition, you spy various flowers and trees around you.  Looking up, you realize that it is nighttime as a full moon shines brightly in the seamless sky without clouds.  Straight ahead, you see a large and imposing doorway emblazoned with the words, 'Count Bleck'.");
	roomarray[0].east= -1;
	roomarray[0].west= -1;
	roomarray[0].north= 1;
	roomarray[0].south= -1;

	strcpy (roomarray[1].name, "a Desolate Hallway");
	strcpy (roomarray[1].description, "Unlike the courtyard, the area seems to be desolate and unkept.  Various wooden barrels lay around; some are smashed and others are leaking a strange purple liquid.");
	roomarray[1].east= -1;
	roomarray[1].west= -1;
	roomarray[1].north= 2;
	roomarray[1].south= 0;

	strcpy (roomarray[2].name, "the Storage: Courtyard");
	strcpy (roomarray[2].description, "It seems the room that you are in is a storage room for gardening materials.  You look around and see shelves stacked full of little gardening tools and wooden chests.  The only source of light comes from a candlewick that fails to illuminate the entire room.");
	roomarray[2].east= -1;
	roomarray[2].west= -1;
	roomarray[2].north= 3;
	roomarray[2].south= 1;

	strcpy (roomarray[3].name, "the Chemical Room");
	strcpy (roomarray[3].description, "Your attention is immediately caught by a large plant in the center of the room; it must be over 10 feet tall with spiked appendages swinging wildly around.  Since the monstrosity lies in the middle of the room surrounded by a fountain spewing out a purple paste, you believe that you can traverse the room without trouble.");
	roomarray[3].east= 4;
	roomarray[3].west= -1;
	roomarray[3].north= 5;
	roomarray[3].south= 2;

	strcpy (roomarray[4].name, "???");
	strcpy (roomarray[4].description, "There seems to be no light source in the room.  You find it impossible to traverse the room clearly.");
	roomarray[4].east= -1;
	roomarray[4].west= 3;
	roomarray[4].north= -1;
	roomarray[4].south= -1;

	strcpy (roomarray[5].name, "the Sleeping Quarters: Gardeners");
	strcpy (roomarray[5].description, "Suddenly, bunk beds, dozens of them!  The room is is lined with over 50 beds, each identical to the last; some beds have chests underneath of them, most likely for personal items.  It seems as if looting this room may provide many spoils.");
	roomarray[5].east= -1;
	roomarray[5].west= -1;
	roomarray[5].north= 6;
	roomarray[5].south= 3;

	strcpy (roomarray[6].name, "a Transition Room");
	strcpy (roomarray[6].description, "There is nothing in particular about this room that strikes you as odd or unusual.  Made out of slabs of stone and a single light source overhead, the room is completely barren except for two doors: one behind and one ahead of you.");
	roomarray[6].east= -1;
	roomarray[6].west= -1;
	roomarray[6].north= 8;
	roomarray[6].south= 5;

	strcpy (roomarray[7].name, "???");
	strcpy (roomarray[7].description, "Darkness, again.  The room has no source of light at all and you can't seem to find anything in it.  Upon touching the north wall, you feel a slimy substance...");
	roomarray[7].east= 8;
	roomarray[7].west= -1;
	roomarray[7].north= -1;
	roomarray[7].south= -1;

	strcpy (roomarray[8].name, "a Breezeway");
	strcpy (roomarray[8].description, "You are once again outside where it is still night.  The breezeway is made out of stone; yet oddly enough, strong panes of glass line the open walls of the breezeway, preventing you from escaping.  Outside lies a lavish countryside lined with farms that stretches into the horizon that leads to the same bright moon; you see no sign of human life.");
	roomarray[8].east= -1;
	roomarray[8].west= 7;
	roomarray[8].north= -1;
	roomarray[8].south= 6;

	strcpy (roomarray[9].name, "the Fencing Court");
	strcpy (roomarray[9].description, "After passing through the archway of the Breezeway, you end up in a large court framed by several fortified walls.  The entire court is empty, the ground consisting of broken slabs of stone and dirt, it seems as if the court was never fully constructed.  You look straight ahead and see a strange man wrapped in a blue overcoat...");
	roomarray[9].east= -1;
	roomarray[9].west= -1;
	roomarray[9].north= 2;
	roomarray[9].south= 0;

	return;
}
//********************************************************************************************

//	HEADER FIELD OF DREAMS
//	[url]http://web.cs.mun.ca/~rod/ncurses/ncurses.html#formschars[/url] <-- Will Read Soon :D

//	Declarations 
#include "msoftcon.cpp"
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>	

/* 
	COLOUR CODING
	---------------------------
	CYAN= Titles
	WHITE= Prompts and Info
	GREEN= Information Recieved
	MAGENTA= Errors
	---------------------------
*/

//	SAVE CHECK
struct system
{
	bool save;
};
//	Character status
struct character
{
	//	Name of character and experience
	char classman[20];
	int level;
	int exp;

	//	Stats of character
	int hp;
	int maxhp;
	int sp;
	int maxsp;
	int strength;
	int defense;
	int speed;
	int magic;
	bool stat;

	//	Equipped items (corresponds to struct items)
	int body;
	int weapon;
	int boots;
	int shield;
};

//	Equipment stats
struct equipment
{
	int type1;				//	Class type
	int type2;
	int type3;
	int type4;

	/*
		LIST
		--------------------
		0=	Weapon
		1=	Plate
		2=	Shield
		3=	Boots
		--------------------
	*/

	char equipman[20];		//	Name of item
	int strength;			//	Strength Bonuses
	int defense;			//	Defense Bonuses
	int speed;				//	Speed Bonuses
	int magic;				//	Magic Bonuses
};

//	Monster Status (random selection generation)
struct monster
{
	char monsterman[20];
	int expgain;

	int hp;
	int strength;
	int defense;
	int speed;
	int magic;
};

//	Battle Stats Generator 
struct battle
{
	int monsternum;
	int playerattack;
	int monsterattack;
};

//	Rooms 
struct room
{
	char name[32];
	char description[500];	// O_O

	int north;
	int south;
	int west;
	int east;
};
	
//	Functions
void generate_character();
void generate_adventure();
void generate_monster();
void generate_battle();
void monster_attack();
void player_attack();
void generate_item();
void character_man();
void generate_room();
void game_overnow();
void battle_intro();
void experience();
void clear_log();
void save();

//	Arrays
room roomarray[10];
monster monsterarray[10];
equipment equipmentarray[20];

Recommended Answers

All 7 Replies

>character character;
That only instantiates an instance of the structure -- it doesn't initialize it. There are at least two ways to initilize it:
1) in c++ you can add a constructor that initializes structure members

2) set members to something at the time of instantiation: character character = {0,0,0 <etc for each member>}; 3) set each member after construction

character character;
character.member = 0;
// etc for each structure member

The function experience() won't work correctly anyway even when you do correct the above problem. You need to pass the structure into that function as a parameter int experience(character& chr) And don't name the object the same as the data type because it gets confusing. Give the data object a different name something like I posted in the previous code snippet.

>character character;
That only instantiates an instance of the structure -- it doesn't initialize it. There are at least two ways to initilize it:
1) in c++ you can add a constructor that initializes structure members

2) set members to something at the time of instantiation: character character = {0,0,0 <etc for each member>}; 3) set each member after construction

character character;
character.member = 0;
// etc for each structure member

The function experience() won't work correctly anyway even when you do correct the above problem. You need to pass the structure into that function as a parameter int experience(character& chr) And don't name the object the same as the data type because it gets confusing. Give the data object a different name something like I posted in the previous code snippet.

Alright, I'll try naming the structure something else. So what you're saying is that I should set the member variables to something so that I don't get junk data (sort of what I did in the generate_character function)?

I still don't understand what you mean by passing it as a parameter though?

>>I still don't understand what you mean by passing it as a parameter though?
Well, where are the values of that structure supposed to come from? If you hard code the value inside the function then there is no need for all those if statements because the values of the function never change. And that doesn't make sense.

To make that function useful you need to pass the structure into the function as a parameter and the structure must be instantiated in the calling function or somewhere else.

function generate_character() -- here is another example of filling in an instance of a character structure then tossing all that information into the bit bucket without doing anything with it. That make the function completly useless because the values the user enters in that function can not be used anywhere else in the problem. To solve this problem pass an instance of the structure as a parameter into that function void generate_character(character& charman);

Sorry for being so dense here, but I suppose I don't understand what you mean by passing it as a parameter still? I used the code 'character& charman' in each function that includes the structure that I have declared in my header file, but I get the errors:

"Function does not take 0 parameters"

I thought that by doing that, I would be giving it a parameter?

Bump for help.

So I have declared the 'character& charman' in each instance when I am defining a structure in the header file, but when I try to run the program, anytime when I call a function, it says that the function being called does not take 0 parameters? What does this mean?

anytime when I call a function, it says that the function being called does not take 0 parameters? What does this mean?

It means that you simply need to supply one or more parameters to the function, depending on how that functions defined.

// you must pass one integer to this function
void function1(int xyz); 

// you can call this one without a parameter, 
// in which case xyz will be zero
void function2(int xyz = 0);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.