49,757 Topics

Member Avatar for
Member Avatar for agarg12

What's wrong with this code.... //templates #include<iostream> using namespace std; template <class t> t max (t w,t x) [B][COLOR="Red"]--->here i get no error if I use &w and &x in place of w and x...[/COLOR][/B]{ if(w>x) return w; else if(w!=x) return x; } int main() { int a=10,b=343,c; c=max(a,b); cout<<"Max="<<c; …

Member Avatar for agarg12
0
131
Member Avatar for shbunch

I have an assignment where I really have no idea how to even begin. It is as follows: •Create a destructor that prints a message before exiting. •Create a new function called void incrementMinutes( Time &, const int ); That increments the minutes by count. • create a member function …

Member Avatar for VernonDozier
0
97
Member Avatar for Marcial

Hello, I made the following code based on the following physics problem: "A sphere of metal has a radius of 6.7 cm and a density of 9.27 g/cm^3. What's the mass of the sphere?". The program runs error-free, except that it gives me a result (mass) of 8758.99 grams. The …

Member Avatar for VernonDozier
0
151
Member Avatar for blee93

How would I convert a string to an integer? I found a method online, but I don't really know how it works. The method is subtracting the character '0' from the character. Supposedly, this makes it an array, but I do not know why. Can anyone explain why? And are …

Member Avatar for frogboy77
0
206
Member Avatar for Akill10

Hey, I am starting to work with SDL and I had it all set up correctly etc. The thing that does not seem to be working correctly is the SDL_ttf. Now, As far as I am aware, linux builds don't use truetype, which is why I am at a loss …

Member Avatar for Akill10
0
173
Member Avatar for pokemal

Hi friends, I need very urgent Turkish-English dictionary program code (university project) Would help please.

Member Avatar for Zjarek
-3
85
Member Avatar for Labdabeta

I am making a screensaver and it won't build! The error I get is "undefined reference to '_SDL_main'. Here is my code: [CODE]#include <windows.h> #include <scrnsave.h> BOOL WINAPI ScreenSaverConfigureDialog(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { system("TMXDB.exe"); return true; } BOOL WINAPI RegisterDialogClasses(HANDLE hmodule) { return true; } int …

Member Avatar for Labdabeta
0
258
Member Avatar for Zjarek

In my project I tried to use boost RNG in such manner [CODE] inline int rand(const int m){ uniform_smallint<> us(0,m-1); variate_generator<rnggen_t&,uniform_smallint<> > vg(rng,us); return vg(); }[/CODE] where rnggen_t is type of random number generator (rng). But using this (for every generator) instead of rand()%m, is slowing my program at least …

Member Avatar for Zjarek
0
473
Member Avatar for headedtomexico

Is there a way to detour a class method to a static function by passing the implicit "this" manually? I'm specifically trying to detour endscene, i've done it with a class member, and writing the address to the new class member into the vtable, but i'm trying to see if …

0
70
Member Avatar for SWEngineer

I have typed the following program from [I]Learning OpenCV[/I] book: [CODE] #include "highgui.h" int main(int argc, char *argv[]) { IplImage *img = cvLoadImage(argv[1]); cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE); cvShowImage("Example1", img); cvWaitKey(0); cvReleaseImage(&img); cvDestroyWindow("Example1"); } [/CODE] When I try to build it using `Eclipse CDT`, I get the following (Any ideas?): [CODE] **** Build …

Member Avatar for ziggystarman
0
1K
Member Avatar for winrycool1

I would like to be able convert one format to another(not immediately but eventually),know how to use tree and hash tables and linked lists properly using classes. I want to be able to do a basic graphic user interface and use pointers well. I've heard of the following books: Exceptional …

Member Avatar for mike_2000_17
0
196
Member Avatar for ROTC89

Hi whenever I compile my program, I am getting this as a a error. well.cpp: In function âvoid printmaze(CELL (*)[20], std::string)â: well.cpp:234: error: a function-definition is not allowed here before â{â token well.cpp:416: error: expected `}' at end of input well.cpp:416: error: expected `}' at end of input well.cpp:416: error: …

Member Avatar for ROTC89
0
110
Member Avatar for subith86

Here is my piece of code: [CODE] int b[2][2] = { {4,6}, {-3,0} }; int b_length = (sizeof b)/sizeof(int); int *sub_b = b[1];[/CODE] b_length will have the length of 2-D array b (4, in this case). now sub_b is the sub-array of b at row 1, which is {-3,0} Is …

0
44
Member Avatar for helbirah

Hi, i'm a newbie, and i have a trouble with a program. The program doesn't work as i desire. This is a little fragment of my program: [code=c] //Requesting data from users. cout<<"\n\nEnter your last name:\n\t"; getline(cin,flast); cout<<"\nEnter your mother's maiden last name:\n\t"; getline(cin,mlast); cout<<"\nEnter your first name:\n\t"; getline(cin,name); [/code] …

Member Avatar for jonsca
0
118
Member Avatar for Greg8202

Hi All. I have developed a cgi script in C/C++ to dynamically create PDF forms with data filled in from an Oracle database. To do this I used PDFlib (version 7.0.1). The submit button on the form submits a FDF file to the server where it is saved via another …

0
90
Member Avatar for jimJohnson

I am finishing up a program and have a few issues. I get the following error twice in the program... error C2664: 'CreateFileW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Can someone please …

Member Avatar for luce
0
208
Member Avatar for faizlo

Hi, I am doing a C++ self-study and I got stuck with this problem. I want to have a code that asks the suer to enter two numbers and then it lists the numbers between these two numbers. It has also to print a message if these two numbers are …

Member Avatar for winrycool1
0
164
Member Avatar for margeaux54

ı have problem with this program because ı want cin>> number; int count[number]={0}; ... .. .. for ( ............ ) count[b]=count[b] +1; ı could not such a segment in my program. my aim is that for each entered number , ı will count something ı want to learn this. devc++ …

Member Avatar for margeaux54
0
100
Member Avatar for sreekiranws

Hello I need some help as to the limitations or flexibility of header files. I have written a code that updates a base folder when it is compared to its newer version. I have hit on a roadblock though. If a new file is added to the folder, the program …

Member Avatar for WaltP
0
208
Member Avatar for hous3aholik

Hi everybody, i cant seem to make my program to pass the first user input. I know i have to put it inside a do while loop, but everyone of my attempts results in an infinite loop. I'm also aware that i should use a bool to make it work, …

Member Avatar for VernonDozier
0
2K
Member Avatar for blee93

Hi, I am doing Question 4 of the Project Euler puzzles. I wrote some code which is supposed to find the biggest palindrome from the product of 2 numbers. However, this always prints out 900099. I cannot really find any errors in this code, but if you do, please let …

Member Avatar for blee93
0
107
Member Avatar for pandaEater

How do you pass an unknown object into a function and save it? I'm trying to have a set and get function in a class I'm creating that can hold and return any object. Here are my attempts so far: [CODE] void* holder; void setHolder(void* object) { holder = object; …

Member Avatar for pandaEater
0
4K
Member Avatar for Szeth

#1. Add functionality to store the guesses the user makes in an array up to a maximum number of guesses stored in a constant. #2. Display the list of guesses after the correct guess has been made. #3. The list will be stored in an array of objects from a …

Member Avatar for Szeth
-2
150
Member Avatar for woofers

Hello.. I have a bit of a situation here. I am trying to work with OpenSG. I downloaded the package and installed it as it was instructed in the INSTALL file. Then i installed its system dependent libraries as well. Now i tried to build its tutorial and it shows …

0
96
Member Avatar for fish234

Can I ask what the programing languege used in iOS? I heard it was Xcode but I'm not 100% what that is, lol if anyone can give me a hand it would be great. Also (and I know this is kind of a supid queston) can you use and C++ …

Member Avatar for Vermillion
0
125
Member Avatar for jkoske

[CODE] template <class T> class Llist //.... //Iterates to position and sets pointers to node at position-1 and position. template <class T> void LList<T>::iterate(Node<T>*& previous, Node<T>*& next, unsigned short pos) { //some code } //Start Iterator template <class T> inline Iterator<T> LList<T>::start() { //some code } template <class T> class …

Member Avatar for template<>
0
143
Member Avatar for mitrious

In the last chapter of my book we implemented a simplified version of the vector class In the chapter I'm studying now we're implementing a simplified version of the string class ... which uses my version of the vector class (called Vec) to hold chars. [CODE]Str(const char* cp) { std::copy(cp, …

Member Avatar for mitrious
0
163
Member Avatar for arjunaw

In a unix pthreads based app I'm working on, I have objects of a particular class (call it class foo) being created in multiple threads. I need a specific public method of class foo invoked at or after 60 seconds of the object coming into existence (it is not imperative …

Member Avatar for arjunaw
0
4K
Member Avatar for ctpsolo

So I am having trouble with the most popular error ever, memory access violation. To make a long story short I am dabbling with an old program I once wrote, it's main purpose is to parse some stuff and download some files. (It's too huge all in all so I …

Member Avatar for ctpsolo
0
192
Member Avatar for aqnie

hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it. Can somebody give me some example how to write pseudocde from this code. [CODE]//This …

Member Avatar for aqnie
0
117

The End.