Can u explain or provide a link to the 3rd template of Multiset?
Thank You....
User Profile
Collapse
-
STL Multiset with Class Objects sorted based on its member variable
Hi,
I was looking at the MultiSet STL structure with some "less" keyword. I was told that we can use the "MultiSet" STL structure to automatically sort the content.
Is it possible to store and Sort CLASS objects based on a class variable value in it .
i.e.
multiset <Event, less<Event> > _queue;
where Event is a class with the variables in it
... -
Thank You for the reply. I think this will help me.
I am new using the STL structures and am enjoying learning all these stuff...These make out work so easy..Leave a comment:
-
Which STL datastructure for O(log n) search ?
Hi,
Iwas trying to look for a STL datastructure in C++ where I can store structure variables and then get out value from it by just comparing the value as follows;
The structure variable: "strctvar";
The STL datastructure: "STLstruct" ;
Storing multiple different of "strctvar"s into "STLstruct" ;
to get a particular value of "strctvar" in... -
Thank You for the correct solution and also the description of why we should use less of Global variables...
I have changed my program to have it as LOCAL instead of Global now..
Thank You again
---------------------------------------------------------------...Leave a comment:
-
Declaration and Initialization: can it be done seperately
Hi,
I am trying to declare a Global String Array pointer
and initialize it in themain function after I get the size of itCode:string **matchedWires;
I get the following error when I try to compile doin like thisCode:**matchedWires = new string*[noofwires];
...Code:GaleShapely.cpp: In function âint main(int, char**)â: GaleShapely.cpp:68: error: no match
-
Is this solution for programming or normal windows task thing...I wanted to know if there is a function in C++ whcih will recall a function every x seconds...
I dont want to run some program in a scheduled fashion...I want to write a C++ program which will simulate a cafetaria in whcih I need to know how to call a function every x second...
Thank You.
Regards,
Digital Don...Leave a comment:
-
Call the same function after a particular time repeatedly
Hi,
I want to write a program to simulate a cafetaria in which a customer enters the cafetaria every 10 ~ 50 seconds. So I wanted a function to be called every 10~50 seconds depending on what time is chosen by the random number generator.
I want to know which header file has the function whcih will help me repeat a function call every x seconds. I know there is one in the GLUT library but I want to use a non Graphics header... -
Call by Reference not working, am i doing it wrong
Hi,
I am working on my OpenGL C++ assignment to create the STARCASTLE game. Most of my code uses call to function in different classes (files) without any parameters but when I need to send parameters to other classes I cannot send the reference instead a new instance is created in teh other end.
I am doing it the following way tell me if it is right...
in StarCastle.cpp in timerFunction
...Code:s
-
The problem with arrays was that it was asking me to "initialliz e the array" which I declared in Main()...and declaring a 'n' sized array is not a good idea...
Thanks for the help regarding the VECTORS......Leave a comment:
-
Digital Don started a topic Problem with Debugging/Tracing in Visual Studio 2005 : Assembly code instead of C++in CProblem with Debugging/Tracing in Visual Studio 2005 : Assembly code instead of C++
Hi,
I have been using Visual Studio 2005 for 5 months now and quite a few time I have come across a problem which is, when I write a program and try to debug and trace the error/problem in the program. using step by step procedure i.e "F10" after pressing F5 (Debug Mode) from Break Point I get disassembly code instead of showing the steps in the program...
I dont know know why this happenes and need to get rid... -
STL Vectors call by reference using vectors of structure
I have a problem sending the Vectors as Referencial parameters..i.e . I am having a struct vector
...Code:struct board { int r; int c; }; void rd(vector <struct board> cp) { cout<<"\nr="<<cp[0].r; cp[0].r=8; } //--------------------- /*This Read function should catch the vector reference and any modification done to -
Thank You
Thank You man....I think I got the concept behind BREAK now clearly...
i.e. I can "break" out of only the inner most loop, not all the loops at a time...
and if i am using loop and switch and I use break inside switch statements, I will break out only of the switch statement but not the loop...right? The loop will still go on till loop condition !?
--------------------------------------------------------------------------------------...Leave a comment:
-
Not clear on the use of break statements
Hi,
I am not clear with the concept of usage of "Break" statements
...Code:for(int r=0;r<9;r++) for(int c=0;c<9;c++) { if(current->brd[r][c]=='1') { cout<<"\nFound 1 @ (r,c)="<<r<<","<<c; if (up(current->brd, temp,r,c) )// the up mode is valid { -
Thank You Man...I used Clear at the end before close and it worked fine......Leave a comment:
-
Hi Macklin
Thank You for your response. I am using Visual Studio 2005 and in that I havent got any compiling error.
It compiles fine and reads input any number of times...
The loop works fine if an invalid filename is given. when first time a valid filename is given it works and reads it...when a different file name is provided it doesnt open the new file, instead it opens the first file or in case of ifstream...Leave a comment:
-
Reuse of File pointer
Hi,
I have been using C++ for the past 6 months and always had a problem of using the same IFSTREAM variable to read multiple files.
...Code:do//Repeat while quit not entered { ipf.clear(); cout<<"\nGive file name (Q for Quit):"; cin>>ipf; ipfilename.open(ipf.c_str(),ifstream::in); //Not able to reuse the above pointer with new filename (ipf) -
char[3][3] array doesnt work in Set of C++
I am writing a program for Peg solitaire...
To check for no repetition of previous states I use a Set for storage of Board states..
The pronblem is when I declare the set as type char[3][3] i.e. set <char[3][3]> open it doesnt take any char[3][3] values into it and says cannot convert char[3][3] to const char[3][3]...
I wonder why is it converting char to const char when I have declared that it shud...
No activity results to display
Show More
Leave a comment: