49,756 Topics

Member Avatar for
Member Avatar for Szeth

Hello Everyone, I have a random number game program that I need to change to use a Class with a constructor. This is my first attempt at using these things, and the instructor hasn't been much help. I watched all of antiRTFM's videos up to video #37, but using constructors …

Member Avatar for ravenous
0
372
Member Avatar for VasquezPL

Hi...I need to write dynamic menu... which will take all items from ini/cfg gile cfg file will look like that: [CODE] TEMPLATE_NAME=LEX UPDATE PL=Czesc to jest update. ENG=Hi this is uptade. TEMPLATE_NAME=WINDOWS ERROR PL=Blad ENG=Error! . etc . . [/CODE] Items will be read to dropdown menu called TEMPLATES.. I …

Member Avatar for jonsca
0
255
Member Avatar for VanHackman

Hello, I'm trying to open a URL wit the default browser in C++ using ShellExecute(), however I'm unable to do this, even using the example into the mocrosoft site. I'm not sure about what I'm missing. I have: [CODE] #include <windows.h> ... private: System::Void Go_home_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e) { ShellExecute(NULL, …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for lochnessmonster

when i create an empty project...my compiler is saying _TCHAR* is undefined...what file do i need to include to fix this problem? [code]#include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //blah blah blah return 0; }[/code]

Member Avatar for Ancient Dragon
0
80
Member Avatar for gavGaz

Hi all, I'm using a vector to store x,y,z values for objects to be draw using OpenGL. I manipulate my vector in a function and then pass it to the method which uses it to draw objects. Basically the value at an element is supposed to be '-2' but if …

Member Avatar for jonsca
0
78
Member Avatar for thehivetyrant

Hi guys, As the title says i have 3 boids, all given a number (0,1,2) by way of [B][I]i=0, i<3,i++[/I][/B] Later on i'm assigning a certain boid to turn red when it gets within range of it's target boid. At the minute its only turning red when it comes within …

Member Avatar for sfuo
0
93
Member Avatar for vbx_wx

How can i rewrite set::inser() function,using a vector::insert() : [code] class Set { std::vector<T> set; public: void insert(const T& t) { set.insert(set.end(), t); } [/code] I tried to insert them at the end,but it wont work corectly.

Member Avatar for dexblack
0
138
Member Avatar for Transcendent

[COLOR="Red"][B]The flowchart is on the attachment. Please check it out[/B][/COLOR] [COLOR="Red"][B]I also get this error: error: cannot convert `__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' to `char' in assignment|[/B][/COLOR] [CODE]/*************************************************** The following program will take user's input and check whether it is in the following language: <S> ---> a <B> | …

Member Avatar for mike_2000_17
0
322
Member Avatar for jackmaverick1

Hmmm... I'm trying to call a class and it doesn't work and i get this error /home/XXXX/Desktop/language/main.cpp|13|error: expected constructor, destructor, or type conversion before ‘.’ token| The syntax is: [CODE] print.base="print"; [/CODE] this simple method call returns an error. Am i really doing something wrong, seeing as i've already looked …

Member Avatar for jackmaverick1
0
117
Member Avatar for caltech

[CODE]#include <iostream> #include <cmath> #include <iomanip> using namespace std; int divides(int,int); int main () { int count = 10; //int prime = divides(count); int p = 0; // number of primes cout.setf(ios::fixed,ios::floatfield); cout << setw(6) << "NUMBER" << "\t" << setw(8) << "DIVISORS" << endl << endl; while (count<=50) { …

Member Avatar for caltech
0
125
Member Avatar for pseudorandom21

[url]http://www.boost.org/doc/libs/1_46_0/libs/smart_ptr/shared_ptr.htm#ThreadSafety[/url] This section somewhat confused me, in my code I have a matrix of shared_ptr's pointing to an entirely thread-safe class. But the shared_ptr documentation says it is only as thread-safe as the built-in C++ types. Does this mean that if I read/write to my thread-safe class using shared_ptr's at …

Member Avatar for mike_2000_17
0
180
Member Avatar for cppgangster

Hi, is here any other issues then readability between two functions below? [CODE] void getNames(int) { .... } void getnames(int meaningfullName) { static_cast<void>(meaningfullName); ... } [/CODE]

Member Avatar for cppgangster
0
109
Member Avatar for poloblue

Good Afternoon, Can someone help me with this program which is an assignment for a class. I'm new to C++ its my fist course in computer science. The assignment details are: 1. The function removeAt of the class arrayListType removes an element from the list by shifting the elements of …

Member Avatar for poloblue
0
2K
Member Avatar for gavGaz

Hi all, I'm trying to create code which manipulates data within a vector. The vector contains floating points which store consecutive 3D values. For example element 1 stores object 1 x coords, element 2 - object 1 y coords, element 3 - object 1 z coords, element 4 object 2 …

Member Avatar for Fbody
0
168
Member Avatar for i_luv_c++

Hey guys! I am working on a project using single linked list and currently on the last task which is overloading the += operator. My merge from a+=b is inefficient because I am having a memory link problem and its slow when it used in list size of 100000. Please …

Member Avatar for WolfPack
0
539
Member Avatar for lashatt2

will find number which is used frequently(often) in x array [CODE]int i; int x[i],frequency[i]; for(int i=0;i<3;i++) { cin>>x[i]; frequency[i]=0; } frequency[i]=0; for(int i=0;i<3;i++) { frequency[i]++; cout<<x[i]; } frequency[i]++; cout<<x[i]; cout<<frequency[i]; [/CODE] what should I do extra

Member Avatar for VernonDozier
0
114
Member Avatar for SolidSora

I'm trying to make a program where it displays the users name based on what they entered. For example if the user enters: John Average User the output would display User, John A. And if the user enters John A. User the program would output User, John A. The problem …

Member Avatar for atticusr5
0
105
Member Avatar for stereomatching

compiler gcc4.5 minGW OS : windows xp sp3 I try something like this [code] template<typename T, typename U> class fastRowSum { public : fastRowSum(); typedef void result_type; //what is this line for? template<typename inputItr, typename outputItr> void operator() (T const VALUE, inputItr ref, outputItr out) { error = VALUE > …

Member Avatar for mike_2000_17
0
226
Member Avatar for pato wlmc

SORRY FOR THE NOOB QUESTION, but until some time ago (1 or 2 weeks) all my programs we comand-line, so I didn't have to... build them(?) But some days ago, i decided to create a program with GUI, and I used QT creator for that. Now My program is finished, …

Member Avatar for pato wlmc
0
116
Member Avatar for daviddoria

I have been using a [icode]Image<Node>[/icode] as the main object to store the data for my program. It is a 2D grid of Node objects. The nodes have properties like [icode]bool Visited[/icode], [icode] float Priority[/icode], etc. I often want to modify these nodes, put some of them in a vector …

Member Avatar for daviddoria
0
162
Member Avatar for canadiancoder

Hi Folks, I'm hoping this is a trivial question with an equally trivial answer. I've got a C# program that I'm experimenting with, which simply passes an array of doubles and the size of the array to a C++ DLL. The DLL will then simply add 500 to each element …

Member Avatar for canadiancoder
0
136
Member Avatar for madval88

I have saved a 2D matrix in a numpy file (.npy) in python. Is there a way I can access the same from C++ and possibly read in the values in a stl vector? [URL="http://www.scipy.org/C++_Extensions_that_use_NumPy_arrays"]This [/URL] is vaguely relevant. But here you make the call from python. I want to …

Member Avatar for madval88
0
752
Member Avatar for mrgreen

hello, I'm fairly new to programming in general, and i'm having some trouble figuring out how to use a stack and queue to check to see if a word or certain order of numbers/letters form a palindrome or not. My logic is to read in the original string, push/pop characters …

Member Avatar for biljith
0
173
Member Avatar for maikens

Hi all, I have written a balanced binary search tree as part of an assignment (make a simple Spell Checker). Each node has, among other values, two height ints, leftHeight and rightHeight, to keep track of the heights of any subtrees. My problem is that after a rotation, the heights …

Member Avatar for maikens
0
1K
Member Avatar for Transcendent

I'm supposed to write this c++ that take in 01 and on. for example: 01010101 but not 0,1,10,011,110. Can someone help me figure out what I need to do to fix the problem. [CODE]#include <iostream> #include<stdlib.h> // for the exit(1) function using namespace std; char text[300]; char ToBeChecked; char lexical(); …

Member Avatar for caut_baia
0
147
Member Avatar for Vanquish39

[CODE] #include<iostream> #include<vector> #include<string> using namespace std; struct Item{ string itemName; double cost; }; class User{ public: User() : itemList(0) {}; User(string a, string b) : fN(a), lN(b) {}; void addItem(Item a) {itemList.push_back(a);} vector<Item> getItems() const {return itemList;} void printUserInfo(); private: string fN; string lN; vector<Item> itemList; }; class Convention{ …

Member Avatar for Fbody
0
146
Member Avatar for maikens

Hi all, I wrote this recursive function to set the heights of each node in a search tree. It is not performing as expected; I suspect I screwed up the recursion somehow. Anyone know what the matter is? [CODE]void AVLTree::SetHeight(NodePtr &node) // root is passed in { if(node == NULL) …

Member Avatar for mrnutty
0
137
Member Avatar for Stefano Mtangoo

If I'm not mistaken using library that is GPLed will force your app to go GPL. Is there a way to get away with MySQL GPL licence and use it in closed source (Not necessarily commercial)? Two scenarios here: 1. libmysqlclient is linked dynamically 1. libmysqlclient is linked statically Thanks!

Member Avatar for Stefano Mtangoo
0
444
Member Avatar for shantanusinghal

[CODE=c] int main(int argc, char *argv[]) { ifstream inHandle; Assembler obj; if(argc!=2) { cout<<"InvalidInput ERROR"; } else { inHandle.open("test.asm"); if(inHandle==0) cout<<"FileNotFound ERROR"; else obj.pass1(inHandle); } inHandle.close(); return 0; } [/CODE] this is my code for the main() function, i have tried entering the filename in every possible format but the …

Member Avatar for Narue
0
629
Member Avatar for Smithy566

I'm trying to compare two DateTime objects, but I am receiving the following error. error C2664: 'System:: DateTime::Compare' : cannot convert parameter 1 from 'System:: DateTime ^' to 'System:: DateTime' I'm just trying to use the DateTime 'Compare' method to perform the check. Below is an example to illustrate what …

Member Avatar for jonsca
0
1K

The End.