49,761 Topics
| |
My professor has assigned a machine problem that asks us to write a program using cin.getline, strcmp_s, and strcpy_s to get a string of words and then count how many times those words were used in the sentence. I have searched online for a solution to my problem but I'm … | |
I have to construct a class for strings. C++ already has one, but my assignment is a home-made version. I am very lost as to how to make the constructor work. I have toyed with a few things, but I was given a header file to follow and I have … | |
Hey all I have a bit of a problem, I need a little help fixing this little error problem. The Error is "error C2668: 'sqrt' : ambiguous call to overloaded function" it is on this line of code: [code=c++] void myint::square() { // Output square root cout << "The square … | |
I am making a word ladder and have gotten some headway on creating a tree design but for some reason in my insertion function I am getting an error saying that this is the "first use of this function" This function being my vector<node*>"children". (I have the area marked with … | |
I'm having several difficulties with memory leaks in a program (I've been using "Visual Leak Detector" to check for memory leaks). I've simplified the code to the following: [code=C++]#include "vld.h" #include "vldapi.h" #include <string> #include <vector> class BaseFoo { public: BaseFoo() {} ~BaseFoo() {} }; class ButtonFoo { public: void … | |
Hi guys, I have a question regarding C++ classes and polymorphism. I understand the concept of pointers and that polymorphism with respect to operators(+, -, etc...) means that the operators can have different meanings based on "context" (how they are used). My question is regarding class pointers. For example, if … | |
Hi! I've been having some problems in getting a hold of the current selected item. All the clicking works fine, but when using the up/down arrow key problems start occuring. Lets say item 0 is marked when the user decides to unmark it. If the user then presses the down … | |
Hey guys, How would I make this program work without a "while" just using "if" statements. I know doing it this way is probably more efficient but there must be a way to do it with just "if" statements. Thanks! :) #include <iostream> using namespace std; int main() { int … | |
Hello I am trying to compile libwbxml so i can convert xml to wbxml. However i am not successfull, i keep getting alot of errors (I opened up the .dsw file and tried to build it. I have no prior knowledge of either VC++ or building any C programs). I … | |
Dear guys, Here I'm gonna show u how to overload different operators in c++. First of all I'm going to overload unary operator(the operator that acts on one operand) that are `++` and `--`. so lets overload the `--` with a simple example. #include<iostream> using namespace std; class school // … | |
I have made a game on c++. Can any one help me to improve it (by adding graphics) and making code short. [code] #include <iostream.h> #include <conio.h> #include <time.h> #include <dos.h> void main() { clrscr(); int i,a=21,b=0, c[5]={0,4,3,2,1},z; char x=15; cout<<"\n\n\n\n\n\t\t\t\t\t\t\tWelcome"; cout<<"\n\n\nRules:\n\n"; sleep(1); cout<<"1. There are 21 match sticks between … | |
hi everyone i have written a simple program which asks for the colour and no of wheels of a vehicle. i used gets() for inputting colour of vehicle.but it was skipping that line. some body suggested me that it is buffer problem and use cin.getline() with getchar() function in while … | |
How to make map with two kwys. I am using struct. struct Key { char * gi; char * offset; Key(const char * _gi, const char * _offset) { gi = new char [strlen(_gi) + 1]; strcpy(gi, _gi); offset = new char [strlen(_offset) + 1]; strcpy(offset, _offset); } ~Key() { … | |
It seems like SO often I need to attach a "valid" flag to a standard type. For example - I have a function called "CalculateLunchTime" that I pass a vector of times. If the vector has 0 elements, they did not take a lunch, so the duration is 0 minutes. … | |
hi all , i need to return the value of tempdate to the main function .... any idea how i can do that ??? [code=cplusplus] #include <string.h> #include <sys/time.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include <iostream.h> char* incrementdate(int &func_days_int,char *tempdate) { char temp_dat[11],temp_mon[8],temp_year[5]; int cur_dat,cur_mon,cur_year; temp_dat[0] = tempdate[0]; temp_dat[1] … | |
Hi, I am creating a hash table which is basically a pointer array of 6151 elements. I use it for chaining. But my code doesnt work properly. There's an error at T[i]=NULL and at function call. This is how it goes: [code=cplusplus] #include <iostream> #include <string> #include <vector> #include <fstream> … | |
Hi all This may seem relly naive but I'm only new to C++. If, in the future I want to build charting software for stock-charts, etc and want a very professional and portable widget toolkit to use with C++ which one should I use and what should I be looking … | |
i m making a program which initializes a 2d Dynamic array by first asking for the number of rows and columns,and then filling the array with random characters. Then i have to check for a three lettered array in the 2D array,(Horizontally,Vertically,Diagonally). i m having problem with the conditions for … | |
can anyone please suggest me any library or programming method to plot contour of a surface using its x,y and elevation. Thanks in advance | |
Hello, I'm writing a simple C# connectionless UDP application that communicates with a C++ connectionless UDP app. I could send from the C# to C++ using the following sets of functions fine: Send from C# to C++ C#: SendTo() C++: recvfrom() However, I'm having trouble receiving the C++ UDP messages … | |
hey ol, i dnt hav much time left to solve des Q's.. can u plz guide me solving des... Fundamental Exercise /* class design, dynamic memory allocation and operator overloading */ 1. Write a program to implement Matrix class. • Implement addition and multiplication operation • row and col of … | |
Ok is there any why i can call the base class this pointer or object from with in a derived class? Example: [CODE=cplusplus] class BASE { public: BASE () {} BASE(BASE & b){} virtual ~BASE () {} virtual void Method(){cout << "BASE::Method called"; return; } }; class DERIVED: public BASE … | |
I am using RDLC and i want to add dynamic text in header as well as in footer and some images in to the header but i cant understand how to add it in same rdlc. i can add static text in header as well as footer and when i … | |
Hi there! I have written a program with fixed costs for a vacation. I need to add sales tax in for the total amount but this needs to be floating. Also, I had intended this to be a user input based program, but without knowing the float code for calculation, … | |
Hey guys, I'm getting an error at lines #9 and #14. Could someone tell me what I'm doing wrong? [code=c++]StackType::StackType(const StackType & st) // copy c-tor { if ( st.topPtr == NULL ) topPtr = NULL; else { NodeType * stptr; // pointer to source Stack NodeType * p; // … | |
Hi, I'm writing this code where I want to match a string with a signature. A wildcard '?' would mean it can skip 1 character. A wildcard '*' means it can skip 0 to 32 characters. For example, say I have: string "screwed" and a signature "screw?d" These two would … | |
Hey friends, Started c++ not to logn ago and took right to it, up until now I have had no problems whatsoever. Now, with my specific assignment I have absolutely no idea what do to. I dont even know where to begin. I feel foolish and embarrassed and I'll i … | |
I'm having a hideous problem with a program I'm working on involving a map with pointer keys. The keys are pointers (to objects on the stack) and the data are pointers (to objects on the heap). It's the list of references for a handle class, so that if handle.destroy() is … | |
I have to write a program that outputs the length and width of a rectangle and then calculates and outputs the area, using a class called rectangle... I thought I was about done, but when I run the program it says width, length and area are being used without being … |
The End.