49,756 Topics
| |
Here's the problem: I need to implement a stack as an adapter to a List class. I don't know what that means though! I've researched on Google countless times and still don't understand what an adapter is. All the examples I've seen point to using inheritance and then using the … | |
Hey when I don't template my classes, I can pass member functions to eachother normally. But when I template it, I get errors. The two functions are defined as so: CustomType& Delete(int Position); CustomType& Delete(T ValueToDelete, bool All = false); CustomType& Delete(CustomType ValuesToDelete); And Implemented like this: template<typename T> CustomType<T>& … | |
Hi, Is anyone familiar with this problem in BorlandBuilderC++: void Print(AnsiString Path){ Label1->Caption=Path.c_str(); } ... Print("C:\Directory1\Directory2\Music.mp3"); When I pass this string to Print(AnsiString) and try to display it in Label1, I lose all '' signs and text in Label1 looks like this : **"C:Directory1Directory2Music.mp3"** Why is this like that? Thank … | |
How can I do the following but easier? I'm templating a class but I want it so that if typename T is of a literal type such as a string or char, then it can use the following member-function. If not then it cannot use it. I've been using typeid … | |
These are the guidelines; 1. Create and initialize an array containing the following tax rates: 0%, 5%, 10%, 15%, and 20%. Create and initialize another array containing the following income amounts: 0, 10000, 20000, 50000, 100000. 2. Prompt the user to enter a gross income amount. Read the gross income … | |
Good Evening (in CET) to everyone. I am in need of a bit of help. I have the following cpp and.h files: dirmain.cpp #include "dirseq.h" #include <iostream> #include <algorithm> #include "dirseq.h" #include <string> struct IsEven { bool operator()( int i ) const { return i % 2 == 0; } … | |
Assume you are looking to buy a house in a new development.After looking at various models they are majestic,split-entry,and single-story.The builder gave them the base price and the finished area in square meters of the three models.They want to know the models with the least price per square feet.Write a … | |
**Dudearoo** *Useing Code::Blocks* Heys you guys! ive got a question, i want to know if its possable to read a file name like for example dudearoo.dat and output the name ive got an idea for it, just i dont know how to read file name not coded into the program. … | |
I've read that anonymous structs are a compiler extension and codeblocks allows them as long as -pedantic-errors are not enabled. My question is, since it is not legal in C++, what would be the legal equivalent of: typedef union XYZ { int Color; struct { BYTE X, Y, Z; }; … | |
Hello, I have been programming for a little while, but I wouldn't consider myself very novice yet. Yesterday I started a project but ran into difficulties with getting the position of the object (apply_surface(0,0,Ss,screen,&clip[0]); to change based on the key input because they are in different headers and stuff, so … | |
**Dudearoo** *useing Code::Blocks* Hey you guys! I've got an problem, i want to print the current time, simple as that. heres my Code. #include <iostream> #include <stdio.h> #include <time.h> using namespace std; int main() { time_t rawtime; struct tm * timeinfo; char space[50]; time (&rawtime); timeinfo = localtime(&rawtime); strftime(space,80,"Current Time:%h%m%p",timeinfo); … | |
Hey c++ maniacs out there ^_^ I need your help to edit this code. In such a way that this program can generate all prime numbers from 10000-50000. BUT it will still ask the user what limit he wants but the limit should be between the said default limit ( … | |
Hello guys, I need to develop my own peap protocol. I've found some source code to inspect, but i dont know how to compile it. In Linux? In Visual Studio C? Please help me. I'm getting so pressed :s Here is the source codes : client : http://www.codeforge.com/article/116327 server : … | |
Simple conversion between string and int. | |
So, I just did a fresh install of ubuntu 11.10, and am in the process of reinstalling gsl. For some reason, my old make file seems not to work, and am trying to figure out how to change it. Last time I had a similar problem, people in here were … | |
I have 3 objects in Open Inventor: a lamp, a desk, and a painting. I need to -be able to place them on each other, such as a lamp on a desk, and a painting on a wall, -the objects can't penetrate the walls and floors (which I have a … | |
How can I cast a class to another type? Example: class Point { Point(int X, int Y); }; Point A(10, 10); POINT P = (POINT)A; A = (Point)P; //I've tried: Point::Point(POINT P) : X(P.x), Y(P.y), Color(0) {} //Constructor. Point& Point::operator ()(POINT P) { if (X != P.x && Y != … | |
I'm supposed to create a virtual catalog, change color/texture of objects, and improve the camera control in Open Inventor. I think I understand the basis for changing the color of an object such as in http://www.mc3dviz.com/openinventor-forum/showthread.php?p=480 but I'm also supposed to be able to change a file as well. With … | |
Answer by true or false : a) There could be several function calls in a program. **True** False b) Function call can be placed wherever it is required, regardless of the function’s number of calls. **True** False c) There are no conditions on where to place a function prototype. True … | |
can someone explain me how it does not swap my nodes? void Library::sortList() { book *head = NULL; book *current = head; book *newBook; current = head; ifstream infile; infile.open("LibraryData.txt"); if (infile.is_open()) { while (!infile.eof()) { newBook = new book; infile.ignore(100,'#'); getline(infile,newBook->ISBN); infile.ignore(100,'#'); getline(infile, newBook->author); infile.ignore(100,'#'); getline(infile, newBook->title); infile.ignore(100,'#'); getline(infile, … | |
hi friends... The following code is for getting tables list from specific database from MySql... =================================================================== #include <windows.h> #include <iostream> #include <mysql/mysql.h> using namespace std; int main() { //connection params char *host = "localhost"; char *user = "root"; char *pass = ""; char *db = "prakash"; //sock MYSQL *sock; sock … | |
From where to start in making an application like Dropbox ? Exists any code snippets or some api ? If not possible in C++, C# is good ... Thanks :D. | |
// this is the code i have so far. // please lend a hand on this please w your ideas// #include<iostream> #include<string> using namespace std; const int SIZE=50; main(); { ifstream inFile; float Grades[SIZE]; int SumOfGrades[SIZE]; int index 0; index 1; index 2; index 3; index 4; index 5; index … | |
Hello everyone, my classmate is making a library manager program and he was able to read the items on the txt file, however when we run his program a couple of times it did not read the txt file again can someone help us with this? #include <iostream> #include <string> … | |
Hello daniweb people! I'm having a few issues with this triangle program. We're supposed to make a few different triangle shapes, including the two i have in this. The first triangle works, but the second triangle displays xxxxxxxxxxxxxxx times infinity. Any ideas on what i'm doing wrong? And another question, … | |
Well I like to learn as much code as I can in a day and I just came across the copy constructor. I do not understand when I need to use it. Do I need to use it for every class I make? I came across it after getting the … | |
Hi everyone I am writing a program to sort an array, but I have a problem removing the duplicates ... so can someone please point me to the right direction or show me a sample program based on my code. for example, the user gives in a row the following … | |
This is a school assignment. I have to write a function in my program that opens a file stream and returns a heaped value to the main function. I believe the file opening function works but after it passes the ifstream pointer to the main function, I'm having trouble dereferencing … | |
Hi, I want to know how to concatenate numbers in C++. int a = 4; int b = 5; int c = a+b; I have tried this but this give me sum of int a and b. I want 4 and 5 concatenate in c variable and give me out … | |
I want to re-use a vector<short> over and over in a performance critical loop. I only need the vector **size** to be reset to zero at the end of the loop. I'm worried that the myVector.clear() takes time to actually clear all the memory. Also, does the myVector.reserve() survive the … |
The End.