49,757 Topics

Member Avatar for
Member Avatar for hardikvd

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....

Member Avatar for mrnutty
0
87
Member Avatar for shea279

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 …

Member Avatar for shea279
0
2K
Member Avatar for jen140

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 …

Member Avatar for jen140
0
243
Member Avatar for Antun

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(); …

Member Avatar for JameB
0
119
Member Avatar for dchunt

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"; …

Member Avatar for Ancient Dragon
0
100
Member Avatar for mandofl

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 …

Member Avatar for mandofl
0
7K
Member Avatar for huzeifa

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.

Member Avatar for Ancient Dragon
0
68
Member Avatar for iammfa

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

Member Avatar for Salem
0
65
Member Avatar for metalclunch

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 …

Member Avatar for metalclunch
0
115
Member Avatar for Nickyu0712

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> …

0
70
Member Avatar for gauravmishra

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; …

Member Avatar for kvprajapati
0
93
Member Avatar for charlweed

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( …

Member Avatar for wildgoose
0
235
Member Avatar for iamsmooth

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 …

Member Avatar for iamsmooth
0
93
Member Avatar for xfreebornx

[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]

Member Avatar for mrnutty
0
112
Member Avatar for flamingice

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 …

Member Avatar for Hiroshe
0
94
Member Avatar for ryancfc

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 …

Member Avatar for ryancfc
0
171
Member Avatar for shea279

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.

Member Avatar for John A
0
268
Member Avatar for Lust_for_Pain

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 …

Member Avatar for Lust_for_Pain
0
66
Member Avatar for kylelyk

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 = …

Member Avatar for kylelyk
0
254
Member Avatar for wardensmat08

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 …

Member Avatar for wildgoose
0
249
Member Avatar for atch

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 …

Member Avatar for atch
0
79
Member Avatar for jarrax

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* …

Member Avatar for Lerner
0
89
Member Avatar for kylelyk

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?

Member Avatar for William Hemsworth
0
94
Member Avatar for SeeTheLite

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?

Member Avatar for kvprajapati
0
93
Member Avatar for julia2009
Member Avatar for Ancient Dragon
0
46
Member Avatar for dchunt

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 …

Member Avatar for Ancient Dragon
0
98
Member Avatar for jarrax

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* …

0
64
Member Avatar for atch

Hi, I've written some fnc and when I tested it it works perfectly but when I switch from debug mode to release mode I'm getting error: Intrisinc function, cannot be defined. Any idea what's wrong? [CODE] typedef unsigned int u_int; int strcmp(const char* s, const char* s1) { u_int size_s …

Member Avatar for atch
0
114
Member Avatar for mathavan2009
Member Avatar for VernonDozier
0
80
Member Avatar for arunplr

Hai , For that last two hours i have been troubling with a problem. I want to get the modified date of a text file. i wrote a sample program , worked fine. But when i attached this program as a function to my actual application , it shows the …

0
44

The End.