49,760 Topics

Member Avatar for
Member Avatar for seanbp

[CODE] DynamicTypeList list; list.add(42); list.add("forty-two"); for (DynamicType* item = list.begin(); item != list.end(); item++) { if (item->what_type == item->is_int) { cout << item->integer << endl; } else if (item->what_type == item->is_string) { cout << item->string << endl; } }[/CODE]

0
553
Member Avatar for seanbp

I was reading a post somewhere on this site about making a type-dynamic list and came up with this. The issue is I'm thinking it's leaking memory when the list grows. Finally, are there any ways to improve this code? [CODE]#include <iostream> using namespace std; class DynamicType { public: union …

Member Avatar for seanbp
0
111
Member Avatar for krosty4782

Hi! Im having a problem in the next line: i = socket.Receive(buffer) buffer is defined as: byte[] buffer = new byte[1024]; It crash when its waiting for the answer. In c++ im sending this: len = send(sock,"hola",4,0); Any idea? Thanks

Member Avatar for krosty4782
0
174
Member Avatar for meensatwork

Iam getting the error Heap Corruption Detected if i run the following program. If i comment out the line delete[], iam not getting the error. Also if i change the [B]outTxtStr = new char[outTxtLength + 1][/B] to [B]outTxtStr = new char[50][/B] iam not getting the error. Does anybody have some …

Member Avatar for meensatwork
0
126
Member Avatar for Lando_

Final Edit: lol im dumb but the brackets backwards [CODE]#include <iostream.h> int main() { const int SIZE = 10; int numbers[SIZE]; int count1; int count2; int highest; int lowest; cout << "Enter an array of ten and I will find the highest and lowest" ; cout << " values" << …

Member Avatar for seanbp
0
118
Member Avatar for rgutierrez1014

Hi everyone, So I tried making my program here, and I got an error that I can't figure out. I have a class for a Binary Tree, "Stree", with a few methods defined publicly, and a "Node" class defined privately, within "Stree". These methods use "Nodes" as parameters. Now when …

Member Avatar for rgutierrez1014
0
278
Member Avatar for crosario90

Im writing a progam that calculate a person test score then prints out a letter grade bt i need to modify it so that the function "PrintGrade" actually keeps track of the highest score entered this is what I have so far... //This program reads a course score and prints …

Member Avatar for crosario90
0
173
Member Avatar for DevonParsons

Hi Daniweb, I've almost always found solutions for various problems before and have now decided to become a member so I can contribute as well. I would consider myself a so-so programmer (I understand classes, pointers, matrices, I/O, vectors, and of course structure). I am only able to make code …

Member Avatar for daviddoria
0
162
Member Avatar for steve_Student

Hi i have completed my assignment for my foundation degree, the details of the assignment are attached describing the C++ program which to be created, which is for a telephone company to log calls and give discount depending on the time of day and day of the week, and to …

Member Avatar for daviddoria
0
240
Member Avatar for sharifyboy7

I am having trouble with my print function for my linked queue. My compiler error is pointing towards cout << tempPtr->info << " "; line 149 tempPtr = tempPtr->next; line 150 in my print function. Can anyone help me fix this? Thanks CODE: [CODE] #include <iostream> #include <cstddef> // For …

Member Avatar for jonsca
0
313
Member Avatar for Lando_

Using Borland 4.5 I think I got most the program done but its hard for me to setup functions with returning names and values. Problems States: Winning Division: Write a program that determines which of a company's four divisions (Northeast, Southeast, Northwest, and Southwest) had the greatest sales for a …

Member Avatar for Lando_
0
1K
Member Avatar for Violet_82

hi guys, I am working on a project for my school, and I was wondering whether I can get some guidance and tips on how to tackle it. Here’s the problem in brief: I was asked to develop a program so that users can input the data values of 2 …

Member Avatar for Violet_82
0
90
Member Avatar for benny2010

When you make sprites does the image file type have to be .png or can it be .jpeg etc.?? cheers for helping me out

Member Avatar for alexchen
0
128
Member Avatar for johntodo

Hey guys, I'm wondering if anyone knows how to write a function that draws a hollow triangle pointing to the right made up of asterisks. The horizontal width of the triangle is passed as a parameter. The statement triangle(4); would display a triangle 4 stars wide: [CODE] * ** * …

Member Avatar for alexchen
0
138
Member Avatar for MasterGberry

I am having an issue using this new operator function that I learned. The program thinks that I am calling the operator=() instead of the operator+() so it is hitting an infinite loop. I marked the areas where there are issues, and i commented some of the newer things that …

Member Avatar for MasterGberry
0
145
Member Avatar for bretttmczk

the code following this is my project. The getInfo() function will not return the information, that is one problem i have having. also anyone have a suggestion for a search function for this? [ICODE]#include <iostream> #include <string> #include <iomanip> using namespace std; ///////////// //Prototypes ///////////// void menu(int&); void getInfo(string[], int[], …

Member Avatar for bretttmczk
0
235
Member Avatar for johntodo

Does anyone know how to compare the first and second halves of a vector? I'm trying to write a function that returns true if the second half of a vector is identical to the first half of the vector. For example, if the vector contains { 3, 5, 2, 3, …

Member Avatar for frogboy77
0
131
Member Avatar for Basteon

Hi! I'm writing the mergesort algorithm, theoretically everything is fine in it but when the function gets to call itself the program crashes. I belive that I'm doing something worng when I pass the vector<int> as a parameter to the function. [B]procedure mergesort(T[1 .. n]) if n is small then …

Member Avatar for Basteon
0
1K
Member Avatar for MacImg

how to load image into array without using Cximage()... actually i need to process iage from array/buffer in visual c++ 2005. what are the steps to be followed to achieve tat...

Member Avatar for myk45
0
84
Member Avatar for snipermann

Hi, I have a problem with reading the Ù’XML file,Can you help me . I need to extract the coordinates of points from the file and later use these points(U,V)to make a polygon . the U and V values are between two tags <contour> and <contour/> Thank you in advance

Member Avatar for ravenous
0
571
Member Avatar for alexchen

I am trying to get a random number without repeating. [CODE]int r,number; srand(time(NULL)); number=10; r=rand() % number+1;[/CODE]

Member Avatar for ravenous
0
18K
Member Avatar for Dingbats

Hi everyone, I'm writing a program for a teacher and friend of mine. It's a simple math-aid prog aimed at children up to 10yo. I was thinking that it would not only be a good idea that a child couldn't shut down the program without a password (obviously), but how …

Member Avatar for Dingbats
0
1K
Member Avatar for blah32

Hello, I am getting very strange behavior on an STL set::insert() . [CODE] ... //Rebuild the P_set P_set.clear();//destroy old P set (shallow only) assert( P_set.empty() ); for(int i = 0 ; i < N ; i++){ cout<<"addr="<< &(C_array[i])<<endl; pair<set<C*>::iterator,bool> p = P_set.insert( &(C_array[i]) ); assert( p.second && "FAILED TO INSERT" …

Member Avatar for arkoenig
0
107
Member Avatar for subrat.agasti

Hi, I have created a tsk scheduler using c++. i have also created a trigger for it. But when I am trying to save the trigger by calling pIPersistFile->Save(NULL, TRUE) method it is throwing an error. The error is: unable to establish existance of the account specified task scheduler How …

Member Avatar for subrat.agasti
0
187
Member Avatar for hworkr

i keep getting an error when i try to pass the array through function. Help? #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; void input(double carSpeed[6][7]); int main (void) { double carSpeed[6][7]; input(carSpeed[][]); return 0; } void input(double carSpeed[][7]) { ifstream FileName; FileName.open("noise.txt"); for(int x=0; x<6; x++) …

Member Avatar for Nandomo
0
115
Member Avatar for Transcendent

[COLOR="Red"]I'm calling sortprint but how can I Implement it? I also want to implement a the sort function. [/COLOR] [COLOR="Green"] I highlighted some of the things in red.[/COLOR] [CODE]#include <iostream> #include <vector> using namespace std; void sortPrint( const vector<int>& v); int main() { vector<int> v; vector<int>::iterator iter; int num; cout …

Member Avatar for Transcendent
0
102
Member Avatar for hq1

I will arrange my output in well-alligned columns, but I don't think I should use 3D char arrays since my teacher just wants us to stick with what we've learned so far. Check out my code. I'm happy about it, but I just can't get the alignment right. [CODE]//File: lab9.cpp …

Member Avatar for Dingbats
0
624
Member Avatar for sadsdw

Hello friends, I'm looking for an short example to read a text file and get lines splitting in 3 vectors. I don't know how I'll do this ... E.G: 100 NAME1 30 150 NAME2 40 200 NAME3 50 -> vectorId[0] = 100 vectorName[0] = NAME1 vectorAge[0] = 30 Can you …

Member Avatar for sadsdw
0
189
Member Avatar for Isbella

Hi everyone....I just need some help...I m beginner in C++ Language. I have to submit a small project. In that project I have to make any small software, application or game. Please help me what should I do???

Member Avatar for StuXYZ
0
276
Member Avatar for LampOil

where would be a good place to learn how to use mfc40.dll & mfc42.dll in Gui C/C++ the things i need to learn about are activex controls to load them useing the ProgID ,ClsID & file name the type of apps i plan to make are to be compiled in …

Member Avatar for SgtMe
0
28

The End.