49,761 Topics
| |
hello guys...Due to some reasons I need to pass a variable's address to MeessageBox(). I am using a function which returns a pointer to the item selected from combo box. Now I want to show this item's name in the MesageBox(). How can I do that? thnx`````` | |
I'm trying to say this: [CODE] string songLocation = "data/sounds/blabla.wav"; PlaySound(songLocation,NULL,SND_FILENAME|SND_ASYNC);[/CODE] but here is the error I get: [CODE]cannot convert `std::string' to `const CHAR*' for argument `1' to `BOOL PlaySoundA(const CHAR*, void*, DWORD)' [/CODE] Does anyone have any ideas? (btw, songLocation cannot be changed from a string. If that happens … | |
Hello people, Quick question. I am working on a mouse maze project, and I need help reading the maze into a dynamically created multi-dimensional array, called "maze". I have already implemented a working code as long as the type of "maze" is char. Below is the code for that: [CODE]bool … | |
I'll try to keep this short. I'm writing a 2D platforming engine and I had good collision detection, but I had to add a separate condition for every platform I had. Essentially the collision function compares the sides of 2 rects. Here is a code snippet of the for loop … | |
I've got a chunk of code that opens up a txt file with 5 or 6 lines inside. I only need to grab the first line of the txt file and put it inside of a variable. The problem is that when I use this code, instead of grabbing the … | |
Can you please suggest an algorithm that uses pointers and I also have to read and save the text file, which I#m having trouble with. Here is a rough translation of the task into English(I used google translator so it's bit jumbled, my german's not that good): Define a structure … | |
[CODE]void DeleteMovie(vector<Movie> &M1){ cout << "Option selected: delete a movie from the database" << endl; string T1; int TT=0; if(M1.size()<1){ cout << ">Error: There are no movies to delete.<" << endl; } else{ cin.ignore(100,'\n'); cout << "Enter the title of the movie you want deleted: "; getline(cin,T1); for(int i=0;i<M1.size()+1;i++){ if(M1[i].Get_Title()==T1){ … | |
I'm having trouble with vectors. I have a class that I read from a file, then I insert it into a vector. It should work fine, but my compiler crashes every time. Am I not using the vector correctly? [CODE]#include <iostream> #include <string> #include <iomanip> #include <fstream> #include <sstream> #include … | |
Hi,everyone! I have to write a program that can find zip codes. I have to read the codes from a txt. file, so i have to use struct arrays In the main program, I just have to enter any random zip code and the program should be able to tell … | |
i have a problem getting it to display the average score of the players entered and also the player names and their scores for those that scored below the average. it works other than that. its late, ive been at this and another program for hours im probably not thinking … | |
Hi guys I got a generic question (looking for a generic answer): I have to load a DLL into C++, I've been playing around all day with it trying to access the methods (I have a big manual for the DLL), so far I have tried the next: 1.- #import … | |
I would first like to start this post with a sincere Thank you to everyone who has posted and will post help for my problem. Without you guys, I would be banging my head on my desk. Well, I got another problem. This time with a function that takes a … | |
Hi, I'm creating an rts game. I'm looking for a way to store unit data. I thought, I'll make a struct for all the required data, and make a multidemensional array of them (one dimension is the different players, the other is the units). The length in both direction is … | |
this is my header file.. sorted_list.h class sorted_list { private: class list_link { private: int key; // identifies the data double value; // the data stored class list_link* next; // a pointer to the next data public: list_link(int,double,list_link*); ~list_link(); }; class list_link* first; public: sorted_list(); ~sorted_list(); void insert(int key, double … | |
Not sure why I am getting it, I got this one other time and forgot how i fixed it.... Getting it when i am calling my functions in the main file (3rd) Three files to this code: [CODE]namespace SALES { const int QUARTERS = 4; struct Sales { double sales[QUARTERS]; … | |
[code] void* thread(void* sockArg) { TCPSocket* s = (TCPSocket*)sockArg; s->showUser(); return sockArg; } int main() { ServerSocket serversocket(4543); try { while(1) { TCPSocket* socket = serversocket.accept(); pthread_t pid; pthread_create(&pid, NULL, &thread, socket); pthread_join(pid, NULL); } }catch(Error& err) { err.what(); } } [/code] Why doesnt my s->showUser(); gets called ? | |
can anybody tell what's wrong with this code! //=========================================================================== // hybrid.cpp --this file implement the hybridlist class // Time-stamp: <2010-10-29 18:52:46 Dnambembe> // To compile: // g++ hybrid.cpp // Copyright (c) 2010 by Domingos Nambembe. All rights reserved. //=========================================================================== #include<iostream> #include<cstddef> //need NULL #include"hybrid.h" using namespace std; typedef NodeType* NodePtr; … | |
I am new to conneting to MYSQL through a C++ code; so this is what i did i installed MySQL Server 5.1 (it was a EXE), and thats it. i opened the MYSql command line client and created a DB, and added a table and values to it. This is … | |
Hey guys, I have a really simple question that I doubt you'll find any trouble answering. Does any of you guys know where I can learn C++? What's the best website you know, and thank you. | |
hi can you tell me what type of data i should use to store a very large number like 500! (factorial of 500) thanks | |
Write a program which initializes two vectors, one of type integer, the other of string. Populate the string type vector with five strings (‘one’, ‘two’, ... ‘five’). Populate the integer vector with [ 5 4 3 2 1 1 2 3 4 5 ]. Write a function that empties the … | |
well here is my problem i had a task to transfrom sequence of decimals entered by user to binary so i did it but here comes my problem it turn out that i MUST have used at least 2 functions 1 main for input output and 1 which contains the … | |
I know many will start with ODBC, but slow down ;) I have searched for ODBC and all I find is UnixODBC. Is this the same as ODBC? Also how stable it is? I will be happy to know some apps/companies behind it! I need support for MySQL, PostGreSQL, DB2, … | |
I am just learning how to work with multiple files instead of putting all my code in 1. When I have the delete lines that are marked it seems to crash the program. I must be over looking something simple here on why it is crashing. [CODE]// golf.cpp -- Definitions … | |
I am using Micosoft Visual Studios 2010 and reached a chapter in my book that asks for seperate compiliation. Up until now I have been using Notepad++ to write my code into a .cpp file and then used Visual Studio Command Prompt with a 'cl' command to compile the code. … | |
Like the title says, I'm having issues creating a tooltip for one of my controls in my dialog. This is what I have: [CODE] HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) { if (!toolID || !hDlg || !pszText) { return FALSE; } // Get the window of the tool. HWND … | |
I'm working on a project that utilizes producers and consumers for an operating systems class. Each producer and each consumer will be its own thread. The producers will generate records that will be stored in a global buffer, in which the consumer will then access to use the data. I … | |
Write exactly four lines of code which declare one vector and one string (of any size and value you choose) and print their size to the console using a call to a member function of each variable’s respective class. I would write a sample but I dont really have much … | |
Hello, I need help on writing a C++ program that allow the user to input two values: a username and a password. Below is what I have so far to test the password and it is not working. #include <iostream> #include <string> #include <vector> using namespace std; int main () … | |
| I'm using Dev-c++ to make a dialog-based app. I had it working, but now I am getting an error: An Access Violation (Segmentation Fault) raised in your program. I have narrowed it down to the winmain function: [CODE]int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) { if (iCmdShow … |
The End.