49,761 Topics

Member Avatar for
Member Avatar for tonyaim83

Hi I m trying to create a map of STL which has set as one of it's element. Following is snippet of my code [code=c] .. std::map<std:string,std::set<int,int> > map_of_set; int a=9; int b=10; std::string str="test"; map_of_set.clear(); map_of_set.insert(test,9,10); //This gives compilation error [/code] kindly help

Member Avatar for sidatra79
0
143
Member Avatar for 2fac323

This program needs to read the infile and calculate the temperatures for each function. I can only get it to output 0's. Can someone explain the steps needed to make this code work correctly? What am I missing? Should I be passing by reference? If so how?? [ICODE]#include <iostream> #include …

Member Avatar for 2fac323
0
161
Member Avatar for Lukezzz

I have declared a vector with 3 Dimensions with the first code below. Then I have managed to push_back all the 3 dimensions so my vector is filled up like this: vector1[2][2][2] [code] typedef std::vector<string> String1D; typedef std::vector<String1D> String2D; typedef std::vector<String2D> String3D; String3D vector1; [/code] What I now need to …

Member Avatar for ArkM
0
2K
Member Avatar for kneiel

This one is on References. [url]http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr110.htm[/url] in the above link (from IBM), they clearly mention that a reference to a (pointer to a reference ) is not allowed.They also say that a reference to other references is not allowed. However, when i tried out both these cases in code, it …

Member Avatar for kneiel
0
128
Member Avatar for dophine

Hi all, I just wrote a small problem to check gettimeofday in a multi-cores environment. [code] int timediff(double fTimeQvs, double fTimeTcp) { int iTimeDiff; iTimeDiff = (((((int)fTimeQvs)/10000) - (((int)fTimeTcp)/10000)) * 3600) * 1000000; iTimeDiff += ((((((int)fTimeQvs)/100)%100) - ((((int)fTimeTcp)/100)%100)) * 60) * 1000000; iTimeDiff += ((((int)fTimeQvs)%100) - (((int)fTimeTcp)%100)) * 1000000; iTimeDiff …

Member Avatar for Salem
0
200
Member Avatar for vedmack

Hi I need to find out if a specific cmd window is opened on the pc, and I need to hide it I looking for that cmd window by its name (cause i know it ) Ive used the EnumWindows with a callback function: [code] BOOL vFound=((::EnumWindows(mFindWindowOnlyByCustomTitle,0))); [/code] and this …

Member Avatar for Ancient Dragon
0
137
Member Avatar for JackDurden

I think I have a memory problem since this code keeps outputting large negative numbers. The file that it reads includes- lastname, firstname, identification number, then 5 decimal numbers. ZDoes anyone know what the problem is? [CODE]#include <iostream> #include <iomanip> #include <fstream> #include <string> using namespace std; const int rows …

Member Avatar for JackDurden
0
80
Member Avatar for alekhya

Hai friends, I'm stuck with a input validation where if nothing is entered and enter is pressed, then i need to display a message saying please enter some value.

Member Avatar for Daveodolph
0
113
Member Avatar for 2fac323

I was spending a lot of time looking around this site to practice with beginner programs. I found one posted by sniper1. And, I tried to make it work. But, now am stuck! Can someone please tell me what is wrong with my code. Problem: 1. [SOLO] Write a program …

Member Avatar for joshmo
0
173
Member Avatar for CoolGamer48

I'm writing a program for a contest (it's a demo, not the actual thing - so I'm not cheating by asking for help - and my question isn't directly related to the algorithm they want anyway). To submit a program, you send them the .cpp file, and they execute it …

Member Avatar for CoolGamer48
1
132
Member Avatar for fmwyso

This is just for my information and I don't really have much need for it... But, I would like to know anyway :D. #1. Is a for or while statement faster than one another? As in, if someone put a for would it be faster (application-wise, not when their typing …

Member Avatar for fmwyso
0
106
Member Avatar for DanDaMan

Hey, I'm just starting to learn C++ and I need some help with a header file. I'm using a Dummies Guide book and it says that I need to create a header file with the extension .h. SO I created a source file called header.h and put this at the …

Member Avatar for DanDaMan
0
159
Member Avatar for Jennifer84

I have a general question. I am trying to read a file named: 1.0.0.txt but this seems not to be possible. The MessageBox shows emty. If I trying to read a file ex named: File1.txt it works. So I wonder why it is not possible to read this file named …

Member Avatar for Jennifer84
0
154
Member Avatar for QuantNeeds

Hello, I have seriously tried to work on this in different manners and now I am back to an infinite output. I have posted for the past 3 days and the responses have just been questions so I am not sure if this is something difficult but I really need …

Member Avatar for ArkM
0
80
Member Avatar for Clockowl

Hey guys, An char* to string conversion looks to be generating a segfault. I'm pretty sure that's not it, but that's when GDB says it received one... Well, here's the, what I think, relevant code. If you think more code is relevant I'll post that too of course. Entity.h (objLocation …

Member Avatar for Clockowl
0
104
Member Avatar for ninjaneer

Hello, I have a C# GUI that is supposed to call a backend I have in a C++ CLI/CLR shared library. That library calls another DLL that was created by MATLAB, but I can't get the second DLL called... Is it a mistake to put the backend in a DLL? …

Member Avatar for ninjaneer
0
161
Member Avatar for coveredinflies

Quick Question. For some reason I can't figure out how to get an array of structures if I am defining the size dynamically. I can do it for a pointer i.e [CODE] struct DB { string name; int age; string ice; }; //some lines DB* data1p; data1p= new DB[no1]; [/CODE] …

Member Avatar for coveredinflies
0
183
Member Avatar for Nemoticchigga

When can you determine if you are using too many threads? Assuming I have complete control and mutex locks and what not, when does it slow my program down, rather than speed it up by splitting up processing into sectons and passing between FIFO queues. Thanks.

Member Avatar for Salem
0
80
Member Avatar for Ccrobinson001

I have a program that deals with anagrams and for the most part the program works but on a few of the words that should be it says that they aren't and one says it is and it's not. can someone help? [code=c++] #include <iostream> #include <iomanip> #include <string> #include …

Member Avatar for iamthwee
0
106
Member Avatar for QuantNeeds

Help the error states: .cpp(31) : error C2337: 'count' : attribute not found referring to new[count] = value; as the problem. My code is the following: [code] int main() { int size = 20; new double[size]; for(int count = 0; count <= size; count++) { int value; cout << "Enter …

Member Avatar for QuantNeeds
0
471
Member Avatar for QuantNeeds

Help, I still cannot understand why the following function will not write the change to my program correctly. For my other functions (add a record and delete record, it wrote all the records perfectly to the file, but for some reason when I go to update a record it does …

Member Avatar for ArkM
0
70
Member Avatar for adelsin

Hello, I'm currently helping a few ladies out setting up a dedicated server. I do not have physical access to this server. Since other people have had their hands in the server, I would like to attempt to construct a program to test several of ports to see if they …

Member Avatar for adelsin
0
135
Member Avatar for JackDurden

How would I add just the columns in this 2-dimensional array? [CODE]#include <iostream> #include <fstream> #include <iomanip> using namespace std; const int rows = 5; const int cols = 5; int main () { ifstream inData; int numbers[rows][cols]; int i,j; inData.open("data.txt"); while (!inData.eof()){ for (i=0; i<rows; i++) { for (j=0; …

Member Avatar for JackDurden
0
88
Member Avatar for gispe

hi ppl im back here with a kinda major problem thing is i made this program for some company that sends letters or packages, and has 3 types of services: to send it the next day with priority, the next day but whithout the priority, or to send it in …

Member Avatar for vmanes
0
91
Member Avatar for kneiel

When an object is instantiated, the constructor gets called ? How is this internally implemented ? Who Calls the Constructor ? Is it the OS ?

Member Avatar for kneiel
0
94
Member Avatar for rppprez

I am using a xbee rf transmission device and i have it connected to my pc via usb. As per the data of the device the information it recieves comes to the pc as it would be coming throgh a com port. I am now trying to create a program …

Member Avatar for rppprez
0
114
Member Avatar for kux

This is cited from Stroustrup third edition [CODE] void f () throw (x2 , x3 ) { // stuff } is equivalent to: void f () try { // stuff } catch (x2) {throw; } / / rethrow catch (x3) {throw; } / / rethrow catch (...) { std: :unexpected() …

Member Avatar for kux
0
104
Member Avatar for Kanoisa

hey, Just starting to learn how to use classes in c++ and when i try to split my class out of the main code and put it in a headder or a headder and a second source file dev C++ is giving me loads of errors and i dont know …

Member Avatar for Lerner
0
140
Member Avatar for bramprakash1989
Member Avatar for CoolGamer48
0
93
Member Avatar for charlinjoe

I am deleting a pointer using "delete" in C++. That pointer is holding the address which is used by OS like 0x00000210. What will happens?

Member Avatar for CoolGamer48
0
90

The End.