49,757 Topics

Member Avatar for
Member Avatar for bleedi

Hey, I have a bit of a problem. I have a class that uses C libraries to make a TCP connection, which is accomplished with the connect() function. Now, I'd like to use this class in a Qt program and make it inherit QObject. The problem is, since I need …

Member Avatar for jonsca
0
231
Member Avatar for saleh-elyani

Hi everybody I wrote this code in my university assignment . But I want to change the global variable (the variables that above the main) to local variable (inside the main) and add the parameters in the functions. [CODE] #include <iostream> #include <string> #include <iomanip> using namespace std; int const …

Member Avatar for saleh-elyani
0
158
Member Avatar for MrJNV

If a user inputs a int number, say 150, how would I be able to read each individual number? i.e., I want to read the 1, do some things with it, then read the 5, and the next number...etc. Thanks

Member Avatar for mrnutty
0
164
Member Avatar for Hand

If I want to throw an instance of a class, where should I alloc the exception object? Should I use heap: try{ throw new Exception("An error was found"); } catch(Exception* e){ std::cout << e->get_message() << "\n"; delete except; } or should not use heap: try{ throw Exception("An error was found"); …

Member Avatar for mike_2000_17
0
130
Member Avatar for MasterGberry

Need to read 4 bytes into a long int format. Both inFileDrs and outFileDrs are in ios::binary form. Is this the correct way to do this? The original piece of code was [CODE]var tableCount = reader.ReadUInt32(); writer.Write(tableCount);[/CODE] [CODE] unsigned long int tableCount, firstFilePos; inFileDrs >> tableCount; outFileDrs << tableCount;[/CODE]

Member Avatar for MasterGberry
0
89
Member Avatar for triumphost

The code below is what I'm having problems with... The combobox part is getting me angry and i've searched everywhere, code guru, msdn, stackoverflow, daniweb... And I cant figure it out. Its for a game my friend plays. I play and quit on and off.. I decided to do a …

Member Avatar for jonsca
0
352
Member Avatar for Nandomo

Ok I am working on this program, I input the information it is supposed to pass it to the structures and then display, but its not there to display, and I know the information can't be missing since the math for the total which is done before displaying is done …

Member Avatar for mcriscolo
0
126
Member Avatar for ChaseRLewis

I am trying to finish up a personal project of mine, but am running into an aesthetic problem. I can't get the window to recognize the hIconSm when I try to set it. [CODE] WNDCLASSEX wnd; ZeroMemory(&wnd,sizeof(wnd)); wnd.cbSize = sizeof(WNDCLASSEX); wnd.hInstance = hInstance; wnd.lpfnWndProc = (WNDPROC) WindowProc; wnd.hCursor = LoadCursor(NULL,IDC_ARROW); …

0
55
Member Avatar for MasterGberry

So I have a few pieces of code that I want to implement into C++, and I think I understand what they are, but I want to check. I have been using an array of char[] to mimic the byte[] idea. So keep that in mind when helping with these …

Member Avatar for MasterGberry
0
157
Member Avatar for OpenSDL

Hi! I have a problem with SDL and OpenGL. I wrote a code to convert SDL Surfaces to OpenGL textures. Now I have a function to Draw a rect(with opengl) on a SDL_Surface. That's the code to draw a rect: [CODE] void DrawRect(SDL_Rect *rect, GLuint texture) { float x = …

Member Avatar for mike_2000_17
0
280
Member Avatar for lochnessmonster

i understand when you use memory on the heap, your program allocates new memory to it to be used...the stack is preallocated memory and when u put a local variable on the stack, and the variables goes out of scope/dies, it technically still stays in memory until you overwrite the …

Member Avatar for mike_2000_17
0
119
Member Avatar for roseworld

Hi, Does anyone have (or know of) VS c++ which performs capture image using Hidden Markov Model, regards,

Member Avatar for roseworld
0
220
Member Avatar for iarkey

Well I'm learning the irc protocol by coding a Console client. The client appears to connect to server, set name and nick, But won't join the channel it just says "451 you have not registered". Here's the code Sorry for any lame formatting ect. I'm kinda new to cpp: [CODE] …

Member Avatar for JZandi
0
161
Member Avatar for Danny1994

Hello, im currently making a save function for my Project wich is like this : [CODE] private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) { String^Sleeptime = textBox4->Text; StreamWriter^ sWriter = gcnew StreamWriter("c:\\DoNotEdit !.txt"); sWriter->WriteLine(Sleeptime); sWriter->Flush(); sWriter->Close(); }[/CODE] And this for the load function: [CODE]private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { if …

Member Avatar for jonsca
0
236
Member Avatar for tomtetlaw

I'm trying to make a Windows application but I get the error in the title. I am running Windows XP Professional and using VC++ 2008. Here is how I call my code: [code=c++] WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = 0; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; …

Member Avatar for tomtetlaw
0
504
Member Avatar for balgarath

alright, I have most of this hammered out, but still a couple problems I cant figure out. in the player class, the Nextmove function is not working for me. It uses the setvalue function in TicTacToe class(which works fine by itsself) also there are problems assigning player names that I …

Member Avatar for zeinab sadat
0
151
Member Avatar for ismailmhd

hi!! i have written this program and it worked, but the problem is ,when it runs it requires username and password. i've no idea about that. plzzz help,i wants to submit immediately.thanks. the code is given below:

Member Avatar for Ancient Dragon
-1
49
Member Avatar for eesti44

Hello, This is my first post. I am trying to teach myself C++ and am having a hard time with a function problem. This is not for homework, I simply want to learn something about C++ and I have no one else to ask. The problem I am having is …

Member Avatar for Freude
0
463
Member Avatar for bobsta

Hi, I use nested arrays of STL objects to generate a large number of objects (shapes representing projections of anatomical structures). I need to filter these into a tractable number based on certain properties that the objects possess: e.g. their geometric relationship to other objects and their functions (pair(int),order(int),left(bool)) A …

0
85
Member Avatar for kikirkou

Hi all A teacher of mine told me that when an object of a class is created then six things are created.He didn't told me which.I know the obvious 4 things 1)Copy constructor 2)Copy asignment 3)Constructor 4)Deconstructor I don't know anything else?Do you have ab\ny idea?I searched everywhere but i …

Member Avatar for Narue
0
123
Member Avatar for Wej00

Just got back into C++ a couple months ago. Mainly, my plan is to get into game development. Hard field to get into, I know, but through school and a hopeful internship this summer, I will be able to fight my way in. I am currently learning SDL and I …

Member Avatar for Banfa
0
1K
Member Avatar for MasterGberry

So I am converting a bunch of very large #s to what I believe is the ASCII standard? or something similar. And I am getting some negative values which is bad, needless to say. the values are the exact value of the conjugate. Example Should be value 214, instead I …

Member Avatar for MasterGberry
0
154
Member Avatar for kra9853

Having trouble running a do while with a if else statement. I'm getting an error saying the "variable 'distanceM' is being used without being initialized." [CODE]int main () { const double PI = 3.141592; double xM, yTheta, distanceM, thetaRad, thetaDeg, xRad, yRad, X, Y; char choice; cout << "This program …

Member Avatar for Zjarek
0
124
Member Avatar for Rickay

[CODE]int main() { static short multiplycounter; static short dividecounter; double decimal; int rdecimal; cin >> decimal; rdecimal = int(decimal); cout << setprecision(10) << decimal << endl << rdecimal << endl; if(rdecimal % 1 != 0) { while(rdecimal % 1 != 0) { if(rdecimal % 1 == 0) { break; } …

Member Avatar for Rickay
0
628
Member Avatar for MasterGberry

I found this code, but I wanted to ask a fast question, does this give the maximum possible resolution? Or just the current resolution set? I know there is a System function but I am trying not to use any System functions if at all possible. [CODE]#include "wtypes.h" #include <iostream> …

Member Avatar for MasterGberry
0
218
Member Avatar for XodoX

So, I have to store ( in a variable?) the number as a Roman Numeral ( M = 1000, D=500 etc.) Convert it to decimal and store in decimal. Print the number as a Roman numeral or decimal number as requested by the user. I suppose it's 2 separate functions, …

Member Avatar for XodoX
0
202
Member Avatar for Jennifer84

I thought about something like this. Is this a good way to do it ? [code] std::stringstream Num; std::string str; Num << 5; str = Num.str(); [/code] I have this: [code] int ist = 5; [/code] How is it possible to convert ist to std::string ?

Member Avatar for Nowayz
0
582
Member Avatar for davi0011

Hello I'm not too experience with c++ but I've learned some of the basics. I tried making a small txt file encryption program however my output prints one too many times to the 2nd txt file. This occurs both when encrypting and decrypting. [CODE] #include <iostream> #include <fstream> #include <cstdlib> …

Member Avatar for jonsca
0
200
Member Avatar for K92

This is the second piece of code I have ever written don't seem to understand what I'm doing wrong. It seems to be going over my head as I have no prior knowledge of any programming language and have literally just begun. I have tried searching the issue to resolve …

Member Avatar for Narue
0
88
Member Avatar for Danny1994

Hello programmers out there again :) Im using this code (Thanks to adatapost): [CODE] private: System::Void textBox1_KeyPress(System::Object^sender,System::Windows::Forms::KeyPressEventArgs^ e) { if(Char::IsDigit(e->KeyChar)) return; if(e->KeyChar=='\b') return; if(e->KeyChar=='-') return; e->Handled=true; }[/CODE] To allows only digits, backspace and "-" But the problem is that you can put the "-" anywhere and as often as you …

Member Avatar for jonsca
0
159

The End.