49,761 Topics
| |
my switch statement is not working properly. it works fine till case 'C', after that nothing is happening. Any ideas? [CODE]void processData(List<Movies>& myList, Stack<Movies>& myStack, Queue<Movies>& myQ){ Movies movieObj; int numInStack = 0, numInQ = 0, num2process = 0; fstream inFile("newReturns.txt"); if(!inFile){ cout << "Unable to open Returns.txt." << endl; … | |
I know you guys have probably seen a tortoise and hare race like this before but I am trying to do it differently... I am new to C++, the only errors in this are when i call the three methods in the while loop in main, it says identifier not … | |
Hi, I'm new here and also new in programming. I have a home assigment to make a c++ program which calculates the difference between two dates in days. (present - dateOfBirth). I don't think I'm allowed to use functions already implemented in c++, but my own. I've found many examples … | |
Any one would help me out to develop a code for a program to convert number from any base to any base..? | |
What is the difference between Structure and Class? Is there are any particular situations when I should use what? Once I implemented Binary search tree using structure. Now, I am trying to implement Red black tree using Class? But many discourages using class in this kind of situation, they say … | |
I have made a header file for SDL GUI applications. I was testing the SDLGame::Draw() function when I got a SigSegV fault. The fault occurs in different locations each time I run the program. Also sometimes instead of a SigSegV fault I get a SigTrap fault. Here is the code … | |
Hi, I'm wondering what which IDEs people use to develop C++ with. I am learning c++ from a background in Java, I am used to eclipse and recently installed Visual Studio. Now, eclipse comes with loads of auto-complete stuff. For example If i write a function and it doesn't exist … | |
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 … | |
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 … | |
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, … | |
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] | |
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 … | |
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 … | |
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. | |
[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> | … | |
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 … | |
[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) { … | |
[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 … | |
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] | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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 > … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … |
The End.