49,761 Topics
| |
Is there any reason to check for self assignment, if you're not using array's or pointers, when overloading the = operator? For example, if the only datatypes in Vehicle are int cylinders and string manufacturer, do I really need to check before assigning? If so, what's the point? | |
[COLOR=#0000ff]//this is the class that I must declare to be public class[/COLOR][COLOR=#000000] Zoo[/COLOR] { [COLOR=#0000ff]private[/COLOR]: [COLOR=#008000]//create 4 pointers to instances of house class [/COLOR]Animal *M; Animal *C; Animal *D; Animal *L; }; [COLOR=#0000ff]// constructor [COLOR=#000000]Zoo[/COLOR]::[COLOR=#000000]Zoo[/COLOR]() { Animal *M;= [COLOR=#0000ff]new[/COLOR] Animal(); [COLOR=#0000ff]char[/COLOR] M[64]; strcpy(M, [COLOR=#a31515]"Monkey"[/COLOR]); M->SetHouseName(M); Animal *C; = [COLOR=#0000ff]new[/COLOR] Animal(); … | |
I'm struggling with my code and was looking for a tutor. Does anyone know of a tutor available? Thank you!! | |
Hey guys. I am trying to take a normal queue and change it into a cyclic queue, which basically means that the enqueue operation will make the elements shift to make space if the rear pointer is pointing at the end of the queue. I am getting an error about … | |
I want to write a program to keep my CPU Usage to 50%.How can I do it? I just can't find the API I need to use.Anybody can help? (PS: My OS is WINXP) | |
i am getting this error : "../incl/GDS_Thread/Thread.h", line 141: Warning (Anachronism): Formal argument 3 of type extern "C" void*(*)(void*) in call to pthread_create(unsigned*, const _pthread_attr*, extern "C" void*(*)(void*), void*) is being passed void*(*)(void*). "../incl/GDS_Thread/Thread.h", line 221: Warning (Anachronism): Formal argument 2 of type extern "C" void(*)() in call to pthread_once(_once*, … | |
I have a class called Person. I also have a class called Truck, inherited from class Vehicle. I want to overload the iostream operators for all three classes so that I can do statements such as: Person a ; Vehicle b ; Truck c ; cin >> a ; cin … | |
I am trying to compare sort methods for my algorithms class and need to write all of the code for each method. My professor wants us to copy a randomly generated array and make 8 copies of it for each of the sorting methods. I'm at a loss as how … | |
All functions compile except the max function where i am trying to get it to find the maximum number in the matrix. The error message says overloaded function with no contextual type information Please tell me why. [code] #include <iomanip> #include <iostream> using namespace std; const int ROW = 3; … | |
I am trying to do a basic program that reads from a txt file and ouputs the results in a specific order on the screen. Its a salary type program. Here is my salary.txt file [code=C++] Randall Jones 25645.88 1999 Jim Johnson 56709 1992 Carol Troth 42387.05 2000 Briannal Deweyage … | |
Hi all I am a noob to C++ and I want to make a program that copies a file from wherever previously specified to the location of where the program is running from, I looked on google but I cant find anything I can understand can somebody please point me … | |
I'm having a lot of trouble designing a switch statement that can take a string value I have to read from an input file and matching it up with an enum value using a switch statement so I can process the string using a function. Complicated, I know. Here's the … | |
Hi all, Just wondering if you could help me out here. bought a copy of c++ for dummies today and the first program in the book converts fahrenheit to celsius. Now I have some C and Java experience (I am a recent graduate of a software design degree) but have … | |
I have a function in my Class which takes a char* from std input. I'm supposed to return an enum type "VehicleType". The function is part of the Vehicle class. It's supposed to return the vehicle type based on index[0] of the char*. I'm confused as how to even start … | |
Hi. I am taking a c++ class and I have to write a program that manipulates polynomials. The assignment requires that you have a largeInteger class from the STL list class. I have the code, but when I go to run it, I am having some problems. I went to … | |
Hello, I am new to c++ I am trying to write a program that reads the keyboard input while running in the background. I am on Linux. It is not easy for me because every example I find makes use of a library I do not have. When I google … | |
Hi I am reading a file with number of frames. frame 1 distance [3072] intensity [3072] amplitude [3072] w_amplitude [3072] frame 2... Now I want to read the data in structure form so that I have:- frame[0].distance[0] frame[0].distance[1].... ... frame[0].amplitude[0] ... frame[1].distance[0] and so on. My code is below and … | |
my intro to comp science teacher gave me an assignment to: 1) enter two different dates with the use of stucts 2) use a swap function to arrange each date in order from earliest to latest 3) use functions to calculate the number of days between the two dates 4) … | |
hi i m new to this forum actually i ve joined this forum coz i m havin problems in c++ i m a student of telecom will any of u plz help me in writing a code for the following programs: 1.write a program that take 5 digit number input … | |
I would like to know what would be the best way to count the nodes accessed while searching for an item in a binary search tree. I have to keep a tally for each item I search for. I have included my search method from my program. [code=cplusplus] void BinarySearchTree::find(int … | |
Good day. My infile contains the following: [CODE] TFFTFFTFFTFFTFTFTFTFFF A33 TFFTFFTFFFFFTFTFTFFFFT Z27 TFFTFFTFFTFFTFTFTFTFFT X12 TFTT FTFFTFFFT FTFTFFF H44 TFFTFFTFFTFFFFTFTFFTFF Q19 FFFFFFFFFFFFTFTFTFFFFF D72 TFFTFFTFFTFF FFFFFTFFF W32 FFFTFFTFFTFFTFTFTFFTTT Y09 TFFTFFTFFTFFTFFTTFFTTT S44 TFFTFFTFFTFFTFTFTFTFFF G11 FFTFFTFFTFFTFTFTTFTFFF J21 TFFTFFFFFTFFTFTFTFTFTT K61 TFFTFFTFFTFFTFTFTFTFT M03 TFFTFFTFFFFFTFTFTFTFFT P24 TFFTFFTFFTFFTFTFTFFFFT N54 FTFFTFFTFT TFF FTFTFFF F33 TFFTFFTFFTFFTFTFTFTFFF Z21 TFFTFFFTTFTTFFTFTFTFTF V39 TFFFTTFTTFTTFTFTFTTFFF … | |
Hi all, Have a question regarding an assignment. In a previous assignment we had to implement a program that allows us to enter a system of connected caves within an underground labyrinth. How this is implemented shouldn't matter for this next assignment though. In this assignment, we have to use … | |
hi i have used the template in my simulation program but it generate the error, my program line of code that generate the error is (these code are in queue.template file) template <class QueueItem> queue <QueueItem>::~queue() // [B]line25[/B] { } template <class QueueItem> void queue<QueueItem>::push(const QueueItem& entry) //[B]line 42[/B] { … | |
I'm getting an error in main() saying TitledEmployee is an undeclared identifier? [code=c++]#include <iostream> #include <string> using namespace std ; namespace Employees { class Employee { public: Employee ( ) ; Employee ( string theName , string theSsn ) ; string getName ( ) const ; string getSsn ( ) … | |
I have been given a problem that asks me to do the following things. Write a program should be stored in two dimensional array. The program must include the following 1. list 4 qtrly sales for 6 divisions of a company. 2. show each division increase or decrease from the … | |
hi .. please can anyone help me with this .. i need it today i wanna to do swith with this .. can i or not? if ( x>y ) cout<< " x is bigger "; else cout<< " y is bigger "; -- and i wanna to do conditional … | |
I am very new to C++ and am taking a beginners course in college. We have a project due this coming tues. and I am stuck, I was wondering if you could please help me. Background on proj: I am working in the circulation dept of a magazine, and it … | |
how do you implement a copy constructor for this pointer-based ADT queue [code] #include "Queuep.h" #include <cassert> #include <new> using namespace std; Queue::Queue () : backPtr (0), frontPtr(0) { } Queue::Queue(const Queue& Q) throw(OutOfStorageException) { //implement here }//end copy constructor Queue::~Queue() { while ( !isEmpty() ) { dequeue(); }//end while … | |
Im doing a program that asks to enter a student's grades on four exams, I have to display the four grades and the average of the four grades, to the nearest tenth. The most problem im having is using the variable call total_grade which i have to initialize to zero. … | |
is the syntax used below is correct? [code=cplusplus] class zz { private : string s; //constructor private: friend zz operator-(zz z); //assume definition of operator<< }; //constructor //operator<< zz operator-(zz z) { string s; s=z.s+"hello"; return zz(s); } int main() { zz a("fsd"); cout<<(-a); } [/code] i am new to … |
The End.