- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
23 Posted Topics
Hey my doubly linked list remove duplictes function will only work when the players in the list are together as in position 1 and 2 or 3 and 4. Otherwise if there not together it will delete the two players. For example, if i have luis suarez at position 1 … | |
i need to restrict the user from inputting an integer and string when inputting a char. I have a method for an integer i just need to adapt it for a char. Can anyone help me with this. char getChar() { char myChar; std::cout << "Enter a single char: "; … | |
0 down vote favorite I am currently making an application to store employee details such as name, id and email address. I am doing this using a HashMap. I am currently having difficulty with a searchByName,id and email address methods. How would i go about writing one ? Here is … | |
Hey i am making an application that stores employee's details and the output is different than what it should be i was expecting the output to be the toString() in the employee class can anyone see anythin wrong: //Imports: //******************************************************************** //Employee Class. public class Employee { //Variables. private String employeeName; … | |
import javax.swing.JFrame; public class MainApp { public static void main(String[] args) { new MainApp().start(); } public void start() { CalculatorUI obj = new CalculatorUI(); obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); obj.setSize(275,275); obj.setVisible(true); } } import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; public class CalculatorUI extends JFrame { //Variables. … | |
There's something wrong with the curly brace's can anyone see where please. //****************************************************************************************** //Header file for LinkedList.cpp. //****************************************************************************************** #ifndef LINKEDLIST_H #define LINKEDLIST_H //****************************************************************************************** //Declaring templates for classes. //****************************************************************************************** template<class Datatype> class LinkedListNode; template<class Datatype> class LinkedList; template<class Datatype> class LinkedListIterator; //****************************************************************************************** //Class: LinkedListNode. //Description: This is a class for the … | |
Hey i keep gettin syntax errors with my header file can someone please help me. //****************************************************************************************** //Header file for LinkedList.cpp. //****************************************************************************************** #ifndef LINKEDLIST_H #define LINKEDLIST_H //****************************************************************************************** //Declaring templates for classes. //****************************************************************************************** template<class Datatype> class LinkedListNode; template<class Datatype> class LinkedList; template<class Datatype> class LinkedListIterator; //****************************************************************************************** //Class: LinkedListNode. //Description: This is a … ![]() | |
Hey i want to know how to make my single linked list a double can anyone help? #include "MyLinkedList.h" #include <iostream> int main() { SListNode<int>* list = new SListNode<int>; //Set 3 LinkedList nodes to contain 3 int variables. list->m_data = 10;//(1). list->m_next = new SListNode<int>; list->m_next->m_data = 20;//(2). list->m_next->m_next = … | |
[CODE]//Header file for Array.cpp. #ifndef ARRAY_H #define ARRAY_H template<class Datatype> class Array { private: //Template for use with the Array's data type. //Member Variables. int size; int grow_size; int num_elements; Datatype* m_array; public: //Constructor. Array( int p_size) { m_array = new Datatype[p_size]; size = p_size; } //Destructor. ~Array() { if( … | |
My methods dont seem to be working for example void Resize doeznt do anything. AM i using it in the wrong way oris the method faulty. [CODE]//Header file for Array.cpp. #ifndef ARRAY_H #define ARRAY_H template<class Datatype> class Array { private: //Template for use with the Array's data type. //Member Variables. … | |
I have errors for the template can any1 see anything wrong??? //Array.h [CODE]//Header file for Array.cpp. class Array { private: //Template for use with the Array's data type. //Member Variables. int size; int grow_size; int num_elements; public: //Functions. template<class Datatype> int m_size; Datatype* m_array; //Consturctor. Array( int p_size) { m_array= … | |
Hey im writing a program and i have countless errors. Im following tuturiols and i have no clue what has happened. Thats the list. Im screwed. can anyone spot anything to get me kick started into a functional game. 1>c:\users\conor\documents\visual studio 2010\projects\ca2\ca2\weapon.h(21): error C2590: 'load' : only a constructor can … | |
In this .cpp i have an error saying member function cannot be redeclared. I dont know what it needs to get rid of the error obviously it needs a declaration somewhere but where? [CODE]#include <iostream> #include <ctime> using namespace std; Monster::Monster(std::string Name, int health, int hitPoints, int miss, int damage,const … | |
Can anyone see the problem with my method ATTACK [CODE]#include "Monster.h" #include "Player.h" #include "Weapon.h" #include <iostream> using namespace std; Monster::Monster(std::string Name, int health, int hitPoints, int miss, int damage,const std::string& weaponName) { Name = Name; hitPoints = hitPoints; Weapon weapon; miss = miss; damage = damage; weapon.Name = weaponName; … | |
Hey i have no idea whats goin wrong with this i think its to do with the fact that its in private but i have an error with calling weapon in the monster class (Monster.cpp) the error states that it is inaccessable :S here is my code: [CODE] //Monster.h #ifndef … | |
Can Anyone advise me on the problem with the namespace in this code im getting an error. [CODE]//Main. #include "Weapon.h" #include "Room.h" #include <iostream> #include <fstream> using namespace std; int main() { ifstream myfile; string line; myfile.open("BronzeSword.txt"); if (myfile.is_open()) { while ( myfile.good() ) { getline (myfile,line); cout << line … | |
Hey im a real noob at c++ and im trying to understand creating rooms setting a default and using a .txt file for room details. but i dont understand it. Im looking at some code from my lecturer and i dont understand were the wiz0-2.save comes from can some tell … | |
I want to place an object into an array so that when i call the array my stats, inventory objects will show up is it possible ? here is my code: [CODE] void displayStats() { const int SIZE = 11; string stats[SIZE]; status Status = {100,20}; cout << "******Stats******\n"; stats[0] … | |
can anyone see why the status.health wont take away the 20 ???? [CODE]#include <iostream> #include <string> // To allow use of Strings. using namespace std; //char inventoryRequest = 'i'; //Function Definitions. void displayInventory(); void displayStats(); void statsObject(); void gameOver(); void stats(); void inventory(); void exitGame(); int playGame(); class status{ public://Access … | |
Hi[QUOTE]just wondering how i would set up a menu so that i can call anytime when pressing "M". im nearly sure it would have to be a loop but im not quite sure how to do it. can anybody help? thanks [/QUOTE] | |
Hi need some help. I dont really know much about classes and objects and i dont understand tutorials and i want to make it that when a user picks up objects it will be added to an inventory that i have set up and also when the inentory is full … | |
[CODE]#include <iostream> #include <string> using namespace std; //char inventoryRequest = 'i'; //Function Definitions. void displayInventory(); void inventory(); void exitGame(); int playGame(); int main() { //Menu Text. cout<< "\t******Menu******\n\n"; cout<< "Please choose one of the following:\n"; cout<< "1 -Play Game.\n"; cout<< "2 -Exit.\n"; int choice; cout<< "Choice: "; cin>> choice; string … | |
[CODE]#include <iostream> #include <string> using namespace std; //char inventoryRequest = 'i'; //Function Definitions. void exitGame(); int playGame(); int main() { //Menu Text. cout<< "\t******Menu******\n\n"; cout<< "Please choose one of the following:\n"; cout<< "1 -Play Game.\n"; cout<< "2 -Exit.\n"; int choice; cout<< "Choice: "; cin>> choice; string name; switch (choice) { … |
The End.