49,761 Topics
| |
1) Could someone explain the difference between composite and inheritance class 2) Is there a composite class with inheritance? | |
Hi, I'm studying operator overloading through [B]C++ the complete referece[/B] and I've got some questions. In the book, the author writes this: [code=C++] loc loc::operator++() { ++longitude; ++latitute; return *this; } [/code] This creates a new object and returns it. [B]1.[/B]Wouldn't it be more efficient to return a reference? [B]2.[/B]This … | |
please help me by doing the following program. I want to feed 80 students name,gender and CGPA.and want to sort in two cases.case 1 sorting with respect to their name case 2 sorting with respect to their CGPA. I would stat it like this. ******************************* #include<iostream.h> void main() { char … | |
What is wrong with my code? It repeats the "Enter the next row:" statement more than once for each time its executed. And the characters turn in to brackets. [code] /* * File: fill.cpp * ----------------- * This program gets the perimeter of a closed shape * as an input … | |
hi, everyone, i am new to C++, i tried implementing a String. and i need your help, i want to know what to improve for this class regarding performance, or everything else you think i should pay more attention to when implementing such a class for general use(of course, i … | |
I have no idea ho to write a program for this problem and i am new to C++ so I really needhelp!! Consider the following file called "raw_points.txt". The first line of this file contains a count of how many pairs of coordinates are specified in this file. The remaining … | |
Trying to create a hash table class that is basically like a spell checker. The header file seems all good but the implementation i'm having issues with. Primarily the insert function keeps vomiting on me when i try to compile. Basically complaining about my iterators being wrong??? Anyways, here's my … | |
Hi, I'm new here. I've got a problem with my project. I get the following link error in VS2008 [code]main.obj : error LNK2019: unresolved external symbol "public: __thiscall PSystemManager::PSystemManager(struct HWND__ *)" (??0PSystemManager@@QAE@PAUHWND__@@@Z) referenced in function "public: virtual bool __thiscall MyApp::OnInit(void)" (?OnInit@MyApp@@UAE_NXZ)[/code] main.cpp is for example this: [code] #include "./PSystemManager.h" bool … | |
Hi I don't know if there is any simple way of doing this but how can I gather how much data has been sent across the network from a certain IP address....for example say i wish to track how much data my PC sends across the network to my internet … | |
OK I have a function that calls an array of class types and I need to remove any duplicates from the array. That is what the function is for. So I created an operator overload for the '+' operator and made a 'Changebalence()' mutator that add two doubles for me … | |
class Calendar { public: Calendar(); Calendar(Appointment mname); void AddToCalendar(Appointment mname); void RemoveFromCalendar(Appointment mname); private: vector < Appointment > meetings; }; // Calendar class Appointment { public: Appointment(); Appointment(vector< person > alist, Time stime, Time etime, Date d, Location p); vector< Person > getAttendees() Time getStartTime() Time getEndTime() Date getDate() Location … | |
I'm trying to make a shuffler for a blackjack program it's supposed to give me back a random number from a deck of cards each time i call it. But it's also supposed to keep track of cards out of the deck.. I need to make it a function call, … | |
hi everyone.. i need to ask 2 questions.. first..is the below code done using recursion or not? second..how can i make the below code take input from a text file instead of generating random numbers and make the output go to a new text file? [code=cplusplus] #include <iostream> using std::cin; … | |
I'm trying to figure out how to do template lists. I have this [code] GList<int> list1; GList<float> list2; GList<string> list3; ifstream inFile; inFile.open("data.txt"); while(!inFile.eof()){ [/code] The code keeps going but that is about all that is important. The data.txt consists of ints, floats, and strings, which are separated by "I"'s, … | |
HI I am getting this error Error 11 fatal error C1083: Cannot open include file: 'Test/Testnamespaces.h': No such file or directory I have included the following statement in the code using namespace Test; Can anyone please tell me the reason for this . | |
[CODE]#include <iostream> #include <string> #include <vector> #include <fstream> #include <iomanip> using namespace std; void getData(ifstream& infile, vector<int>& itemID, vector<string>& itemName, vector<int>& pOrdered, vector<int>& pInStore, vector<int>& pSold, vector<double>& manufPrice, vector<double>& sellingPrice); void do_again(),usersChoice(char ans); void searchInventory(string searchInput); void printReport(); void printHeading(); void sellStock(string sellItem, int numSold); int showMenu(); int ans(); vector<int>itemID, … | |
I keep this error and i don't know why, right now I have base class Runner which has one virtual function which is overriden in a derived class ghost my code is below Runner.h [code=C++] #ifndef RUNNER_H_ #define RUNNER_H_ #include "Maze.h" #include <QtGui> class Runner{ public: Runner(QColor c); int runnerSize; … | |
I didnt know i must post code here so sry everyone :). So my problem is next: I have two exes that need to excange data. I tried using standard ::CreateProcess() and ::GetProcAdress() functions but got errors. I presume thats becouse exes are in different processes. I cant use COM … | |
hi all. Im developing project in c++ with dll, exe and GUI application (EXE). Is there any way for GUI to make access to EXE's data without using COM. thanks in advance! | |
This is my first post, and I'm VERY new to C++, but I just finished my first class, and upon requesting the final, I was told to re-do one of my programs, because instead of computing the values, I just displayed them. (It never said I needed to.) Now that … | |
Hello, i have a simple question about pointers... The code that goes with the problem is: [code] int* getPtrToArray(int& m) { int anArray[5] = { 5, 4, 3, 2, 1 }; m = 5; return anArray; } int main() { int n; int* ptr = getPtrToArray(n); for (int i = … | |
Okay, so I've been working on a program that will allow the user to input what items they want into an array and make the output look like this: Item 1. Sword Item 2. Shield Item 3. Sword Item 4. Armor with some help, i was able to figute that … | |
I am trying to pass the size of the matrix array during the constructor but its giving me the following error. Is there a different way to do this? [CODE]In file included from Main.cpp:1: AdjacencyMatrix.h: In constructor ‘AdjacencyMatrix::AdjacencyMatrix(int, std::string)’: AdjacencyMatrix.h:13: error: ‘numberOfNodes’ cannot appear in a constant-expression [/CODE] Line 13 … | |
I am looking for a command where i can press m and it pulls up my menu function. i feel retarded cause i tried to look it up but i dont know what i should look for exactly i know qbasic has a inkey command but i cant figure it … | |
Hey, guys I think this is a very simple problem and that I just can't get it is due to some gap in my knowledge. Any way, what is wrong with this : [CODE] class A{ private: int value; public : A(int v); }; A::A(int v) {value = v;} //Does … | |
[code=cplusplus]#include <iostream> using namespace std; #define PRINT(x) cout << #x " = " << x << endl; class Object{ public: Object():i(5){} int i;; }; int main() { Object o; o.i = 5; int* p = &(o.i); PRINT(*p); int Object::* p2m = &Object::i; PRINT(o.*p2m); return 0; }[/code] the two PRINT macros … | |
I've been studying enums lately and decided to make a program with it to test the enum syntax and my first one worked. It was: [code=c++] #include<iostream> using namespace std; int main() { enum daysinweek{ monday=0, tuesday=1, }; enum daysinweek enumerator=monday; cout<<enumerator<<endl; system("pause"); return 0; } [/code] It worked perfectly, … | |
Hi all, I'm a beginner at Open Watcom and i'm trying to R/W from and into a file...i used the library "fstream.h" but the scanner shows invalid token... [code] #include <stdio.h> #include <string.h> #include <iostream.h> #include <fstream.h> int main() { ifstream inFile; // object for reading from a file ofstream … | |
I am a fairly new programmer with limited knowledge in C++. I am currently writing a program for my class that involves fractions. I was doing good writing one piece at a time and making it work until the instructor threw a wrench into my plans and asked me to … | |
[CODE] // Description: This is a computer version of the game hangman, the user // can play against a 2nd player or the computer, and he can enter how many // guesses he gets, // // Start of program // Header file definitions #include <iostream> // Standard input/output #include <string> … |
The End.