49,757 Topics
| |
hi i have this question..i solved it but im not sure if its true or not.. template<class t> class c { private: int size; t *p; public: void set(int sv) { if(p!=0) {delete[] p;} p=new t[sv]; for (int i=0;i<sv;i++) cin>>p[i]; } c() { size=0; p=0; } the question is that … | |
So is it worth learning win32 API instead of just shooting straight to Microsoft Foundation Classes? One of my classes covered win32 for a little and I was able to do a couple fun things with it, but then we jumped into MFC. It makes you ask the question, is … | |
I implemented a BFS on a maze that I made, but the one problem that I have is that I do not know how to obtain the indices of the path that it took to solve the maze. Right now all my BFS algorithm does it prints out if it … | |
hi, i have an error in my syntax where define operator +() . compiler says "declaration syntax error" i have. what is my fault!? [code=c] #include<iostream.h> class exforsys{ private: int x,y; public: exforsys(){x=0; y=0;} void getvalue(){ cout<<"\n enter value for x:"; cin>>x; cout<<"\n enter value for y:"; cin>>y; } void … | |
I am having a problem with my code. below i have outlined the home work requirement. please take a look at the second part(this is the code that i have written) I keep getting an error when i try to run the code. The error states:The program '[3716] Lab02 Case01.exe: … | |
Hi everyone. Could someone please help me with this. I have a program which i have written and finished for a college assignment. It is completely done. I have a perfect working copy on my laptop but when i copy it to usb stick and take it to college it … | |
Hey guys, this is my first time posting. I'm almost done with the whole program but the only problem left is the word frequency counter. I have file(.txt) that the program reads on and it outputs the words aphabetically and if the word has been seen, it adds a count … | |
The two classes from the Queueclass5.cpp program are displayed below. Please add another method which will search the Queue for a name which is supplied in its parameter and will return a Boolean value of true if the name is found, or false if not. The method will have the … | |
code file is attached .... [CODE][#include<iostream> using namespace std; class citizen{ char* name; char* nationality; public: citizen(){ //default constructor name = "Usman"; nationality = "pakistani"; } citizen(char *aName, char *aNationality) //parameterized constructur { name = new char[strlen(aName, aNationality)+1]; strcpy(name, aName); strcpy(nationality, aNationality); } citizen(const citizen &obj){ //copy constructor name = … | |
I want to look for letters of a string and then look-up in the alphabet and then write the index number of alphabet array's index . Like; A=0 B=1 etc. c=2 z=25 [CODE]# #include "stdafx.h" # #include "time.h" # #include "stdio.h" # #include "string.h" # #include "stdlib.h" # # #define … | |
i have a question that in 2-3-4 tree ,how 4 state tree or 4 node tree is created.mean that how to insert first 3 data till the nodes are split.can anyone tell me please. Thanku so much. | |
I want to implement a countdown timer in a game, but need some help figuring out how to do it properly. I know that this is probably a very regular question that has been asked a thousand times, but I've been trying out some methods I found through searching, but … | |
im trying to create a class that will create a 20x20 grid with 5 random x's and 100 random o's. But its currently giving me ascii chars instead. any help would be appreciated! [CODE]#include "Lifegrid.h" using namespace std; int main() { int r1; int r2; int r3; int oldi; int … | |
I have to implement a simple infinite sum which estimates the value of PI. The more iterations of the infinite sum, the more accurate the value of PI. Using the equation PI=4x(1-1/3+1/5-1/7+1/9-1/11+1/13-....) .The details of the program are as follows: 1. The program must have a small menu for the … | |
Hey, right now I am working on implementing a matrix class for an assignment. I am using vectors in order to implement it and am having some trouble with adding matrices together. In my private I have defined: int nRows, nCols; vector<int> data; Here is my code for the operator+; … | |
[B]Moderator note:[/B] Originally posted in [url]http://www.daniweb.com/forums/thread269720.html[/url] How can I retrieve the handle of a Windows Form texBox? The property textBox->Handle is not the same thing. [QUOTE=strmstn;1167223]Winapi, if there is a window (hwnd) that has a child Edit control with ID 1: [CODE]HWND hwnd_edit = GetDlgItem(hwnd, 1); size_t len = GetWindowTextLength(hwnd_edit); … | |
#include<iostream> using namespace std; class citizen{ char* name; char* nationality; public: citizen(){ name="Usman"; nationality="pakistani"; } citizen(char * aName, char * aNationality) { name = new char[strlen(aName, aNationality)+1]; strcpy(name,aName); strcpy(nationality,aNationality); } citizen(const citizen &obj){ name = obj.name; nationality =obj.nationality; } void showName(){ cout<<name<<endl; } ~citizen() { delete[]name; } }; int main() … | |
You have to write a program which takes 30 integers representing collection of coins. Each integer represents worth of each coin. The program should also take another input “amount” whose change needs to be found. Your program should be finding the change using minimum number of coins. If change is … | |
i got an error mesg (`undefine symbol _ main in c0.asm`) plz find and correct the error i need it urgently plx help me #include <iostream.h> #include <iomanip.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <fstream.h> #ifndef ADDRESSBOOK_H #define ADDRESSBOOK_H void main() { class AddressBook { protected: int recordID; char … | |
the problem is- it is required to store 'big integers'(more than alloted space for integers), suggest a suitable method by which big integers can be stored , also device an algorithm for adding of such numbers.. the just need the method of achieving this.i can write the code in any … | |
Hi everyone, i'm new in DaniWeb, so forgive me by some mistake, x) I need create a iterator, it can receive any kind of struct of STL, like map, vector, list, ... How i do that? Someone have any idea? Thanks by your attention. Best regards, Valter Henrique. | |
I'm a newborn to programming and my instructor has thrown me to the wolves. I'm trying to compile this simple program but I get these syntax errors. 1>y:\d03423388\desktop\projct3\projct3\prjct3.cpp(16) : error C2059: syntax error : '<<' What do I do with '<<' ? | |
#include<iostream> #include<string> #include <ctime> using namespace std; class Dog { protected: string name; char gender; public: Dog(string theName, char theGender) /*constructor*/ { name = theName; gender = theGender; } ~Dog() { cout << "good bye: " << name << endl; } void bark(int n) { cout << name << ":"; … | |
Ok I'm trying to make a GUI with multiple forms on Visual C++ 2005 Express Edition. And I was following a tutorial and made two forms. Form1 and Second. I want the Second form to open from Form1. So I included Second.h in form1 and then added this to the … | |
I'm creating a simple platform scroller using C++ and the Allegro library, and also .fmp maps created using the tile-based editor Mappy. I have two maps created, which will serve as my two levels. Once the first map is run through, I want to switch to the second map. What's … | |
Employee.h [code]// Base class. #ifndef EMPLOYEE_H #define EMPLOYEE_H #include "stdafx.h" #include <cstring> // Constant for the name's default size const int DEFAULT_SIZE = 51; class Employee { private: char *name; // The name double empNum; // The employee number int hireDate; // Number of hire date on hand // Private … | |
Hello, I am a novice programmer in C++. I know only basic object-oriented ideas and my teacher thinks it is the worst thing that ever happened to mankind and because of that, I only know procedural programming. In addition, he has us use archaic compilers such as CodeWarrior from 10 … | |
Hi, I'm supposed to create a program where I want to purchase tickets to a theater based on rows and columns of the seats. The program uses two-dimensional arrays and constructors, and is supposed to display somethine like this: "ASU Gammage Theater 1. View available seats 2. Request tickets 3. … | |
Alright, so, I decided to write an IRC Bot in C++ to get used to socket programming. Everything went fine of course, but I have one bug: when the server sends me a PRIVMSG (a message sent by a user to the server, then comes to me) it prints a … |
The End.