49,761 Topics
| |
I want to have a template function like this: [code] template <class T> void CreateBlankPatch(typename T::Pointer patch, unsigned int sideLength) { CreateConstantPatch(patch, typename T::PixelType::Zero(), sideLength); } [/code] It works fine as long as Zero() is defined for the class T. However, with POD types, this is clearly not the case. … | |
Hey everybody, So I though that I understood linked lists and arrays well enough to make a hash table with separate chaining. Theoretically, it seems trivial, but I am getting a runtime error. The error appears to arise from the line head = heads[i], where head is a node pointer … | |
Hi, I am loading in a dictionary text file of English words, but I am not supposed to load any words if they contain an apostrophe. I am loading them in as strings, and I cannot figure out how not to load the string if it contains an apostrophe. Here … | |
Hi all, I want to read a file. The file is like that : 20 20 1 5 6 20 21 1 2 3 21 22 2 4 6 20 20 2 3 5 20 21 6 5 2 21 22 1 6 7 .... and I would like every … | |
Hi. This should be very easy for you guys, but I still can't get it visualized in my mind. Here's what I'm trying to do: [CODE] if (flag) for (i = 0; i < 10; i++) {LARGE_BLOCK_OF_CODE (that visits an array in order)} else for (i = 9; i >= … | |
I've got this header and cpp.And I would like to insert this operator overloading to this .h and .cpp file. but I always got errors. Operator OVERLOADING : [CODE]istream& operator>>(istream& in, Focista& jatekos) { cout << "Add meg a focista tulajdonsagait. " << endl; cout << "Nev: " << endl; … | |
can anyone upload a simple modular example in c (They would include .c files and .h files please) i am currently working on modularization but i have a problem when it comes to the main.c and main.h. . . its an assignment. i just want to reference and work on … | |
[CODE]//I have a problem with my program, // the function rank to find rank of a matrix //cannot return the result //somebody help me to correct it! #include<iostream.h> #include<math.h> #include<iomanip.h> class matrix { int n,m; double A[6][6]; public: //..... friend int rank(matrix); }; int rank(matrix B) { int i, j, … | |
[CODE]#include <iostream> using namespace std; const char* foo() { return "Hello"; } const char* bar() { const char* s = "world"; return s; } void print(const char* s) { cout << s << endl; } int main () { cout << foo() << endl; print(bar()); return 0; }[/CODE] Can I … | |
i was wondering how i can make it so i do something like: [CODE]cout << "Press any key to continue." << endl;[/CODE] what kind of code do i need to put it so that the program dosnt do anything until someone presses any key on the keyboard? | |
I need some help with this program, im obviously not so good with this stuff, but since this is the only one i haev left to make i thought i would ask some of you guys for help the problem is: Write separate programs to do the following: 1) Convert … | |
Hi i am mostly done with my assignment where u have to make a simple object viewer. one of the requirements require you to use multiple instantiation of objects from the same class which i do not know what to do about it. This is my code for main.cpp [code] … | |
Hi, I need to download URL's to a file using C++ code. Does anyone know of a library, compatible with Windows, that will do this? I know about CURL, but after spending days trying to configure LibCurl using Cygwin I'm ready to give up. A friend has been able to … | |
i want express graph as adjacency matrix but 2 element of graph have more 1 street should element of adjacency matrix have more 1 value .i don't know express ? who know guidance for me? | |
Hey guys, im currently doing my frigate project for my semester class intro to c++ and im stuck at a part where my program crashes after the ships move for a while, any clues? Also, im stuck in the overall development of the game, im not sure how to get … | |
I am trying to read a txt file into a binary tree. I have the computer create the binary tree from the txt file. Once it adds to the binary it learns what you add. I got it to do the second portion I cant get it read it in … | |
Can anyone be kind enough to teach me how to create programs that are sport related. Such as a program for a football/soccer league that does the following: Store players names, numbers, team, goals scored, etc. Show goal difference, league standings of teams. Be able to log information such as … | |
i was working on a simple calculator and here's the problem I'm having: i want the whole program to loop over and over until the user decides to stop, so i put a while in there and the loop works great, but when the user is done inputting the numbers … | |
I cant solve this assignent. I hope a helpfull soul can help me out. The problems goes like this: Write a program that ask the user to enter the number of seconds as an integer value(use type long) and that then displays the equivalent time in days, hours, minutes and … | |
//I need help please? [CODE]#include<stdio.h> #include<iostream.h> class Time { public: Time(); ~Time(); void setTime(int, int, int); void printMilitary(); void printStandard(); private: int hour, minute, second; }; void Time::printMilitary() { cout<<"Military time: "<<hour<<minute<<second; } Time::Time() { hour=minute=second=0; } Time::~Time() { cout<<endl<<"Destructor code."; } void main() { Time wakeup, samplePM; wakeup.setTime(6, 5, … | |
Hi, I have a homework assignment that I just cannot figure out. I would be grateful of any help. The assignment is: Create a program which: Implements a class called Queue: The class should contain an array of maxQ integers. There should be two constructors: One that takes no argument … | |
My program runs a three dimensional maze (3x3x3 = 27 locations) it has a start room exit room and code room all in a loop so no two are the same location, the start and exit rooms show up on the run compiled program but the code room does not … | |
Okay I have tried everything to alter the code but nothing works, so I ask for your help. The thing is I am trying to turn my code from this: *______* **____** ***__*** ******** ***__*** **____** *______* into this: *________* **______** ***____*** ********** ***_**_*** **__**__** *___**___* ____** ____** ____** ____** … | |
I'm making a simple text RPG game that I will later (once i get the code running well in the text version) put it to graphics and so on. Basically what this code is doing is, there's a monster that the user just killed. based on that monsters level that's … | |
Hi, I'm writing a program in C++ that is driven by events that occur externally to the computer. As far as the program is concerned the event is just a change from false to true and I figure the simplest transmission mechanism would be over a single pin on the … | |
I'm having no luck trying. Is it possible in C++? | |
Talk about C++ & Allegro here, any problems and ideas are welcome! | |
Hi I have a third party code. [CODE]class Lazy { protected: template <class T> static void create( T*& ptr ) { ptr = new T; } }; template < class ClassT, class Policy=Lazy > class MakeT : private Policy { public: static ClassT* instance() { static ClassT* ptr = 0; … | |
How can I create a program where the output is name,horoscope,birthdate and birthstone.. | |
Hey Guys, I am writing a Recursive Function which picks the best move for Computer(sort of A.I.) i have done all the base cases however couldn't figure out how to deal with the last part. [QUOTE]Given n stones the player can remove 1, 2 or 3 stones per move. The … |
The End.