49,761 Topics

Member Avatar for
Member Avatar for daviddoria

Can anyone explain why I can't sort this vector: [code] #include <iostream> #include <vector> #include <algorithm> #include <memory> struct Test { public: Test(const unsigned int input) : a(input){} int a; }; struct SortFunctor { bool operator()(std::shared_ptr<Test>& object1, std::shared_ptr<Test>& object2) { return(object1->a < object2->a); } }; ////////////////////////// int main (int argc, …

Member Avatar for vijayan121
0
4K
Member Avatar for Karlwakim

Hi everybody, Is it possible to write a c++ compiler in c++ ? Its bootstrapping, right ?? In which language are usually written compilers ? Thanks

Member Avatar for vijayan121
0
194
Member Avatar for BCBTP

I have a piece of software, that I would like to license and protect but I am having a hard time finding the right license, and how I would go about with it. Is there a license that allows: - Free distribution of the executable and DLL's - Costs money …

Member Avatar for vijayan121
0
193
Member Avatar for Sarkahn

This is a way to force a given aspect ratio of a window any time the user tries to resize or cascade it. [CODE] double aspectRatio = 640.0 / 480.0; WPARAM sideBeingDragged = 0; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); …

0
466
Member Avatar for triumphost

I have an idea for a program but I don't know if its possible. I want to write a program that can read commands from a file.. For example, I've seen bots that can parse and read javascript for games and execute whatever is in the .java file.. How can …

Member Avatar for triumphost
0
176
Member Avatar for lastbencher

C++ course has started in my college. I would like to know the best beginner book for C++. My teacher has referred Robert Lafore and The Complete Reference. Since there are a lot of suggestions given in the sticky thread, I am confused. Thanks in advance :)

Member Avatar for lastbencher
0
225
Member Avatar for harvybcn

I have a Win32 Application in C++. At runtime, It loads a Matrix stored as TXT file in the working directory with I/O functions. I have problems to distribute my program (EXE and DLL) because people normally forget to move the text files together with the Application. How can I …

Member Avatar for alexb119
0
2K
Member Avatar for khelly

at first, plec correct me this one... [code] std::string explanation; // this upper coding char explanation; //after entering void to display if(item_code=='A') explanation='BABY WEAR'; else if(item_code=='B') explanation='CHILDREN WEAR; else if(item_code=='A') explanation='LADIES WEAR'; else if(item_code=='A') explanation='MENSWEAR';[/code] BABY WEAR and others was error, what should i put? plz correct my coding above …

Member Avatar for gusano79
0
163
Member Avatar for Reeseoo

Hi all new to this forum, just thought i'd post in here because i am having a bit of trouble with an assignment... basically i have this class in a header file called Product.h... [CODE] class Product { private: int _id; unsigned int _price; public: }; [/CODE] I access this …

Member Avatar for Reeseoo
0
529
Member Avatar for joydsouza90

:?: Is there any way, in Turbo C++, by which we can make the mouse disappear when it enters a certain area of the screen ? I have tried this but it doesnt seem to work completely.... ------------------------------------------------------------------------------------[code=c] void initmouse() { union REGS in,out; in.x.ax=0; int86(0x33,&in,&out); } void showmouse() { …

Member Avatar for sourabhjaiswal
0
1K
Member Avatar for sansalama

Hi all I have a program, which I can do and in that program the user can enter information if he had missed to enter it in the required field and he must to be informed about this option. [CODE]//verification of the PIN Edit6->Text = ""; int digits[10]; AnsiString egn …

Member Avatar for adityatandon
0
120
Member Avatar for nicprog

how to write this in c++??? while (Q not empty) { u = deleteMin (Q) for each v adjacent to u if (v is in Q and w(u; v) < key[v]) { key[v] = w(u; v); //decrease key T[v] = u; }}

Member Avatar for nicprog
0
97
Member Avatar for the_kitoper

I have a problem, whenever I attempt to use the following expression it returns -3. Can you please explain why this is? [CODE] int level = ((RoD * 10) - 50) / 15; std::cout << "Level = " << level << std::endl; [/CODE]

Member Avatar for LRRR
0
172
Member Avatar for Kunal0

Hi, I have a basic understanding of C++ and was creating something myself with a class of 6 integers and a string what I want to do is to be able to find the mode values for each of the six integers and strings I have instantiated a set of …

Member Avatar for ravenous
0
282
Member Avatar for thinkingofaname

hey im using vc++ clr to build my application...im using the datagridview, but im having some problems with it because its quite poorly documented in C++..i want to know a couple of things. 1... how to change the color and text of a single row header cell as well as …

Member Avatar for thines01
0
149
Member Avatar for Azmah

I'm looking at developing programs that run on the desktop, cloud (ie. web app), and other devices. I'm looking at how I can code this in C++ and be able to communicate to a server and/or to the client's computer. Is this even possible and do I need the server …

Member Avatar for Azmah
0
153
Member Avatar for thinkingofaname

hey i wanna make C++ program that makes music files but i don't want to use the beep function because that's to simple..and as far as i know doesnt save as a music file....i've looked at csound but that looks a bit to tricky..can u suggest any library's that have …

Member Avatar for thinkingofaname
0
169
Member Avatar for Labdabeta

I have been teaching myself algorithms and I am stuck with the AlphaBeta AI algorithm. I want to test my knowledge of it with a TicTacToe simulation. The thing is I want it to be easy to modify for any two player game and I cannot figure out how to …

Member Avatar for Labdabeta
0
167
Member Avatar for teha_toshio

i`ve done a few codes and i compile it so that i can review it but it got stuck when i want to assign a room. i dont know why.. can someone please help me to fix this please...[CODE]#include <iostream> #include <vector> #include <cstdlib> #include <set> #include <algorithm> #include <string> …

Member Avatar for teha_toshio
0
232
Member Avatar for manfredbill

please help new to c++ programming in this program am trying to input 5 students information and get there output but i got wired error {illegal structure operation} [B]please help [/B] #include <iostream.h> #include <conio.h> struct student { int no; char name[20]; float degree; }; void main() { student s; …

Member Avatar for LRRR
0
3K
Member Avatar for wanguard

This is the program I wrote for my CS project. Compiler is TurboC++. I initially added a lot of garbage code in it and am having a hard time cleaning it up. Can you guys please suggest improvements in the code below. Thanks in advance. [CODE] //STUDENT MANAGEMENT #include<conio.h> #include<fstream.h> …

Member Avatar for adityatandon
0
173
Member Avatar for daviddoria

I know there is an "assignable and copy constructable" requirement for objects in an STL container. For example, you cannot place an object with a const member into a vector. [code] #include <vector> // /home/doriad/Test/Test.cxx:3:8: error: non-static const member ‘const int MyClass::x’, can’t use default assignment operator // struct MyClass …

Member Avatar for mike_2000_17
0
164
Member Avatar for d3m0n

Recently I started working with game development and I came with a problem, when I started working with this SDL_image.h library and I can not understand why the program, does not display the image, screen just flashes and disappears, I can't figure out what's the problem. I am using Microsoft …

0
103
Member Avatar for daviddoria

If I want to expose an iterator to a class member container, I can do so like this: [code] class PatchCollection { public: // Iterator interface typedef std::set<Patch>::iterator iterator; typedef std::set<Patch>::const_iterator const_iterator; iterator begin() { return SourcePatches.begin(); } iterator end() { return SourcePatches.end(); } private: std::set<Patch> Patches; }; [/code] However, …

Member Avatar for mike_2000_17
0
208
Member Avatar for Karlwakim

Hi everybody, I am learning c++ and i want to develop GUI applications Is Directx efficient for GUI apps ? Not games, just gui software. thanks

Member Avatar for LRRR
0
150
Member Avatar for BDove

I'm having trouble finding how to write to a C++ WinAPI TextEdit control programatically. Here is my code for the TextEdit control: [CODE] case WM_CREATE: { OutputBox = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 10, 90, 410, 235, hwnd, (HMENU)OUTPUTBOX, g_hInst, NULL); break; } …

Member Avatar for BDove
0
210
Member Avatar for johnnydarten

Dear all, I'm a C++ beginner and I'm facing a problem with C++ program running on Dev C++ 4.9.9.2. The following program builds and compiles just fine however when I try to execute it it stops before getting any output. Actually the line causing the problem might be the "y_pos[][]" …

Member Avatar for johnnydarten
0
1K
Member Avatar for daviddoria

I have a class called PatchCollection. It is in charge of creating a bunch of Patch objects. It stores them in a member variable of type std::set. Now I want to loop over all of the patches from outside the class. That is: [code] MyClass { PatchCollection Patches; void DoSomething() …

Member Avatar for ravenous
0
134
Member Avatar for bohling

OK, first off I have figured out the prime number algorithm...I guess. What I am needing help with, or wanting the answer to, is how to count how many primes are being displayed. To wit: Enter a Number: 10 There are 4 Primes. The Primes are: 7 5 3 2 …

Member Avatar for bohling
0
225
Member Avatar for chhabraamit

Hello guys , I am looking for a HTML parser in C/C++. I am trying to make a movie rater , which take name of movies from a folder and stores it in a file , then sort it according to their rating on net. So ,I am thinking to …

Member Avatar for thines01
0
519

The End.