49,761 Topics
| |
I am using MS VC++ '08, ad have run into a problem that stumps me : [code] void printtext(char **lotsoftext,int m,int n) { for(int i=0;i<n;i++) for(int j=0;j<m;j++) print(lotsoftext[i][j]); } [/code] The error is as follows : cannot convert parameter 1 from 'char' to 'const char *' How do i correctly … | |
I made an IDictionary where each value is a user-defined class called employee, and the key is an integer (the employee's id number). Now, im using such a statement: [code=CPP] for each(employee^ de in globals::clientBase) { sr->WriteLine(de->employeeName); } [/code] but i get an error at runtime saying that they couldnt … | |
Hello, i have a problem constructing a regular expression to strip out puntuations from a document.Below is a simple example of my code [CODE=c++] # //headers here //... string a="kennedy .really-really. .cool"; string replace=" "; string newStr; boost::regex expression("[ ]+(\\.)|(\\.)[ ]+",boost::regex::icase); newStr=boost::regex_replace(a,expression,replace); cout << newStr << endl; //output kennedy really-really … | |
The google references were a bit varied and ambiguos and my textbook ironically doesn't cover templates ._. if I were to make [code=c++]template <typename typ> class stk { public: stk(); ~stk(); private: struct STK { typ dat; STK *lnk; }; *chn; int ctr; }; [/code] do I have to do … | |
consider this: float a=3.145698,b; que: now how can I assign b=3.14 using 'a' instead of 3.145698. pls help me... thank you very much.... | |
OK so how can i have sscanf scan a string with an undetermined number of separators in it, then separate it out into separate strings inside a array of strings. So essentially, how can I modify this code to make it work? [CODE=c++] char * commands; //simple string as pointer … | |
Hello all. I have some problems with compilation while working with WinApi. Here is the code: [code=c++]// include the basic windows header file #include <windows.h> #include <windowsx.h> // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program … | |
Hi guys, I have started to learn c++ yesterday, and now i have little problem due to lack of knowledge. I developed this simple code: [CODE]#include <cstdlib> #include <iostream> #include <winbgim.h> using namespace std; int main() { int gdriver = 9, gmode = 2; initgraph(&gdriver, &gmode, ""); setbkcolor(WHITE); setcolor(BLACK); cleardevice(); … | |
Now i learnt basic windows programming long time ago and now use dev-cpp,i can run the simple Hello World program in that,but don't know how or where to implement cout and if statements type programming ? [ICODE]#include <windows.h> LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); char szClassName[ ] = "WindowsApp"; … | |
I'm supposed to write a program that stores data about a soccer player in a structure: Players name, players number, points scored by the player. The program should keep an array of 12 structures. Each element for a differnet player on the team. When the program runs it should ask … | |
I have successfully managed to write a program which generates a messagebox but there is one PROBLEM on previewing; instead of "\\n" going to newline it appears visible on the messagebox, when i try "\n" it doesnot work. Please help me. | |
Hi, all I'm beginner in c++, and sure exercises important for any beginner, so i Google a lot about " c++ answered exercises ", and may be i can't search well, so if someone know any " c++ answered exercises " links, tell me please regards iammfa | |
Hello, me again. Sorry for asking such a silly question, but I need the consultation of you guys, experts in my sights. :D Well, basically, I've been fiddling around a lot with C++, looking at various tutorials at the internet, making simple programs such as Calculators, password-protected stuff which spit … | |
Every time I try to execute my program I get an error:"The instruction at "0x00401585" refereced memory at "0x00000028".The memory could not be "read"". Pleas help me! I have linked -lagl -lalleg -luser32 -lgdi32 -lopengl32 -lglu32 I can't see the problem. :( [code=C++]#include <gl\gl.h> #include <GL\glu.h> #include <allegro.h> #include <alleggl.h> … | |
i want to know how to access virtual table for a class this is my attempt to do so ........ [code] #include<iostream> using namespace std; class sample { public: virtual void fun(int q) { cout<<"fun"<<endl; } void g() { int *p=(int *)this; p=(int *)*p; p=(int *)*p; void ( sample::*pfun)(int); pfun=(void(sample::*)(int))p; … | |
I have a member variable wchar_t * _message; This array is allocated in the constructor, _message = new wchar_t [messageLength]; But when I try to free the memory with delete in by destructor, it crashes with a a HEAP CORRUPTION error. This my class: [code=c++] class ExampleZero { public: ExampleZero( … | |
Hey guys, I'm stuck on an assignment for school, was wondering if you could help me out. So I have a text file similar to this: [code] Joe Jim Hello Jim, Just wanted to say hello! -Jim EOF [/code] This is supposed to be like a message system. The first … | |
[code=cplusplus]#include <iostream> #include <cmath> using namespace std; int main() { int a, result, factorial(a); { cout << "please enter a number "; cin >> a; cout << factorial(a); } for(a=1; a>0; a--) { factorial *=a; } return 0; }[/code] | |
This program is supposed to ask the user for 2 numbers first, then print out a menu asking which operation they would like to perform on the number, then output the result. the problem is, there needs to be a function for getting the numbers, functions for each operator, and … | |
Hi everyone! I just want to have random numbers which are unique. For example I want 5 unique numbers for a lottery game I am trying to make, nothing special just a console game. I was thinking of using loops and dead long boolean algerbra lines of || (OR) and … | |
Could anyone recommend some higher-level c++ programming classes that are either online, or local in Austin, TX, that a 16 year old can enroll in? All my school offers is basic java, and ive tried the University of Phoenix online, but 16 is below their enrollment age. | |
Hello all!! Im a newbie when it comes to C++ and I am constructing a program that, a. reads a file called weatherdata.txt, that contains the type of weather, number of years, then the average data for the months(i did three years) b.The program displays the informations for the months … | |
I'm trying to create a function that draws with the mouse using allegro. Here is the original code: [code=cplusplus]int SCREEN_WIDTH; int SCREEN_HEIGHT; BITMAP *buffer; int sandcol; int pthickness; int mx, my, mx2, my2; void ThickLine(BITMAP *bmp, int x, int y, int x_, int y_,int thickness, int color){ int dx = … | |
Hi.. I'm a beginner and just study programming. I have to make some random number. I found many solution in this site, but does'nt seem to be like i want. Please see this [URL="http://lh6.ggpht.com/_T3iApStJb64/SnMJmXJd0WI/AAAAAAAAASM/z5jEJagUjz4/s144/sudoku.jpg"]screen shot[/URL]. I have to make some simple program like sudoku game. And must put random number … | |
Hi, I've tried to output pointer in decimal but can't do it [code] int a = 10; int* p = &a; cout.unsetf(ios_base::hex); cout.unsetf(ios_base::oct); cout.unsetf(ios_base::dec); cout << showbase << dec << p << endl; [/code] it still shows this output in hexadecimal format. Any reason why this doesn't work. Thanks in … | |
My problem is this. I am making a script engine using lua 5.1.4 for a game engine. At some point I want my script to be able to create an event for example a InitializeEvent (there are other events) which will be done through calling this method: [code=cpp] int ParticleSubSystem::GetIniEvent(lua_State* … | |
so I was wondering how to push int's into an array. In other languages that I learned, I can just call the push() method. But looking around, people say that I need to use priority_queue. What is it and can I use it in Allegro? | |
If I delete a pointer, does it delete the data in the current address or all of it? example: [code] bool *dat; dat=new bool; dat=true; ++dat; dat=false; delete dat; --dat; [/code] if I printed dat, would it return true or just a random address? | |
Hi. Is there an alternate solution for variable variables in C ( or C++) like $$ in Php? | |
I want to write a program to read a audio file and classify the various symbols into the number of times they occur , I was hoping i could use a switch statement and classify the 256 symblos but now i've learnt the standard ascii set is only from 0-127,so … |
The End.