51,593 Topics

Member Avatar for
Member Avatar for lochnessmonster

after examineing this code, it seems like it actually allocates space for the pointer....but how? is this a bug? how can u allocate space for an array of 0 elements [CODE]int main() { int *ptr = new int[0]; return 0; }[/CODE]

Member Avatar for template<>
0
90
Member Avatar for cppgangster

Hi I am trying to put up simple app, and i get an error, could you tell me what I am doing wrong please. Here is my code: [CODE] #include <afxwin.h> class myapi: public CWinApp { public: virtual BOOL InitInstance(); }; class myframe: public CFrameWnd { public: myframe(); protected: afx_msg …

Member Avatar for cppgangster
0
555
Member Avatar for InLondon76

Was asked this question for an interview and really wasn't sure how to answer it. Can anyone suggest examples of where a bug will only present itself when using multiple CPU/core and NEVER happen on a single CPU? The question didn't mention "threading", i.e. nothing specific about threads running within …

Member Avatar for template<>
0
328
Member Avatar for valkyrie

I wanted to know,,,clock(); functioning in C++,,,actually I am making a program based on IQ analysis and It has certain time limit in each question for answering,,,but as I don't know how to use clock(),,,,,that's why it's creating a problem for me.....plzzz help me out.....I would be very thankful...

Member Avatar for template<>
0
203
Member Avatar for daviddoria

I realize this question may be impossible, but I'm pretty confused so I'm drawing at straws. I'm trying to use a class from a big library. If I do this: [code] TheClass imageIterator(image, region); [/code] everything works fine. However, if I do this: [code] TheClass imageIterator; imageIterator = TheClass(image, region); …

Member Avatar for daviddoria
0
251
Member Avatar for sudhisandeep

i have entered this particular code in vc++ 2010: [CODE=c]#include<windows.h> int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPInstance,LPSTR i,int j) { MessageBox(NULL,TEXT("HELLO"),TEXT("SAMPLE"),0); return 0; } [/CODE] showing error like this: [CODE=text]1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup 1>D:\projects\sandeep\Debug\sandeep.exe : fatal error LNK1120: 1 unresolved externals [/CODE] please help me. how do i …

Member Avatar for WolfPack
0
100
Member Avatar for fpsasm
Member Avatar for GamerDJX

OK so here's my problem. I am a really new programmer, and my instructor has been giving us assignments that most of us are not exactly ready for. We have this assignment, and I honestly have NO IDEA where to even begin. Bottom line, I need help. Here is the …

Member Avatar for jonsca
0
165
Member Avatar for electrox73

Hi, I am able to create a clock in a console c++ app...like this one show UTC hours:[CODE]#include "stdafx.h" #include <iostream> #include <windows.h> #include <stdio.h> void main() { SYSTEMTIME st, lt; GetSystemTime(&st); GetLocalTime(&lt); std::cout << st.wHour << std::endl; std::cin.get(); }[/CODE] But I am not able to create this with the …

Member Avatar for jonsca
0
303
Member Avatar for c+-

can i make a prototype for a class member function outside of the class declaration? i tried this: but it didnt work [CODE]class cls; void cls::dosomething(); class cls { public: void dosomething(){} };[/CODE] thanks

Member Avatar for template<>
0
513
Member Avatar for SolidSora

I need to make a program that outputs a name based on the users input. For the middle name I'm only supposed to show the middle initial. But the way I have my code written causes an error. [CODE]#include<iomanip> #include<iostream> #include<string> using namespace std; string firstName; string lastName; string middleName; …

Member Avatar for template<>
0
117
Member Avatar for geekme

Hello need help in traversing a b tree from down node to utmost parent node and how can you code for a leaf element, as it has an adjacent node as well apart from no child. REgards

Member Avatar for template<>
0
64
Member Avatar for Taibah

Hello, I started to learn c++. i followed most of the basic things console programming of c++ like loops functions and more but where can i learn now the structure of programming and how i need to think. Are there tutorial about that. because you can not create a program …

Member Avatar for template<>
0
492
Member Avatar for VanHackman

Hello, I'm trying to make draggable a borderless form developed using Visual C++. How ever, I'm not having look with it, and I had been unable to find an example about how to do it around the web. This is the code I'm using currently, and which is not working. …

Member Avatar for jonsca
0
718
Member Avatar for triumphost

Is this possible to embed a console into the gui like the picture below?? If so I wanna know how. [img]http://img229.imageshack.us/img229/6995/cmdahk.jpg[/img] found it here: [url]http://www.autohotkey.com/forum/topic45935.html[/url]

Member Avatar for paulmooreparks
0
208
Member Avatar for scarlettmoon

Hi ~ My program seems to work perfectly with the exception of validating user input. I do not want someone to do the work for me, I don't learn anything that way. I need to know why it works not just what or how. I just need a push in …

Member Avatar for scarlettmoon
0
366
Member Avatar for aaronmk2

I am reading in from a file and when I use .eof() it read everything from the file the I get a run time error of Exc-Bad-Access. When I run a for loop instead the program runs with not errors. Any hints? [CODE] while (!inputFile.eof()) { inputFile>>number>>lowerRange>>higherRange>>cond>>aFName>>aLName>>phase; active=(cond=='t'); sAds[i] = …

Member Avatar for WolfPack
0
131
Member Avatar for Awesumlewy

Hello, I am currently trying to improve my programming skills and I just can’t get my simple program to work correctly. Here’s the problem: I have managed to allow a user to input 10 numbers then when they insert these 10 numbers, the sum and average is displayed, simple! Then …

Member Avatar for richieking
0
173
Member Avatar for Forthright

Hi I am trying to call a 3rd party method which relies on const char* I want to pass an arbitrary value. The (broken) code below should show what I'm trying to do. [CODE] #include <iostream> #define MAX 1000 // 3rd party stuff void ConstPtrMethod(const char* s) { std::cout << …

Member Avatar for Forthright
0
346
Member Avatar for zacblazic

Hey guys, My lecturer told me that when I have solved a problem, I should always look for ways to improve it. I was wondering if it is okay to post my code here and ask the community to comment and tell me if it can be improved, but I …

Member Avatar for anilashanbhag
0
121
Member Avatar for dav555

I try to transmit an OpenCV IplImage from a Server (Ubuntu x64) to a Client (Win7 x64) The following code works fine if both (Client and Server) are on the same operating system. But when the server is on Ubuntu and the client on Win7 it doesn't work. The image …

Member Avatar for dav555
0
427
Member Avatar for micmo

Hi Guys, I have two forms (Main and Sub). There will only ever be one instance of Main, but can be many open windows of the Sub form. What I want to do is know which Sub form was the last form to have focus when switching to the Main …

Member Avatar for zachattack05
0
10K
Member Avatar for AutoPython

I'm creating a program and I need the class 'Child' in the following code to inherit the value of 'age' from the class 'Mother'. [CODE] #include <iostream> using namespace std; class Mother { public: int TellAge(void); protected: int age; } MObj; class Child:protected Mother { public: void ChildTellAge(void); } CObj; …

Member Avatar for AutoPython
0
136
Member Avatar for andy.apple

Hi, I want to sum up all values within a vector of doubles, let say [4.5 8 5 90 24 32 58 1.8 17 25]. The sum is 265.3 which isnt to difficult. But when using the accumulate function I get 264!? [CODE] #include <iostream> #include <math.h> #include <vector> #include …

Member Avatar for andy.apple
0
141
Member Avatar for se00an

Hello all, Inverting an upper (or lower) triangular matrix is a trivial algorithm, due to the nature of the matrix. I am having an issue getting a part of my upper-triangular matrix inversion function to work, and I would like to get it working soon for a personal project. From …

Member Avatar for se00an
1
2K
Member Avatar for CanaznFTW

This is my first post and I'm sort of new to programming and figured joining this forum to try and get some help. So please excuse me if I happen to miss something. Task: - Create a cylinder specified by my program with the radius and height - Which will …

Member Avatar for CanaznFTW
0
4K
Member Avatar for kas04

Ok so I have the easy part of this problem figured out but the other part is confusing me. Here's the problem: Write a program that reads in a line of text and outputs the line with all the digits in all integer numbers replaced with 'x'. Example Input: My …

Member Avatar for jonsca
0
2K
Member Avatar for ziggystarman

Just started looking into visual c++ express 2010 today, no exp at all with this IDE anybody know how to remove these types of errors from project. [CODE]1>AXIMP : AxImp error : Could not load file or assembly 'Interop.MSHelpServices.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot …

Member Avatar for ziggystarman
0
167
Member Avatar for jinx0007

hi everyone im new to this and in am having some issues making this work correctly first when i run the debugger it comes out with some stuff joined together like numbers and words and getting it to calculate the 750 pieces of gold with the reminding explorers not coming …

Member Avatar for jonsca
-1
99
Member Avatar for lochnessmonster

any suggestions on this custom array class?(it compiles and works properly) [CODE]// Sequential_Sort.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <Windows.h> #include <WinBase.h> /** * Class: Array * * Custom Array class used to read input from a file * …

Member Avatar for griswolf
0
439
Member Avatar for TriG0rZ

Hi, Im kinda new to creating C++ gui apps. I am using a application called c++ Builder XE and i was wondering if anyone knew of any good tut for creating a GUI application and any other tut that may help using this application Thank you :)

0
36
Member Avatar for triumphost

Hello everyone, I have one question.. should be relatively simple but I just cant seem to find any info anywhere.. maybe Im just looking in the wrong place and need guidance.. Here is my problem.. I have the following code: [CODE] EnableMenuItem(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE , MF_GRAYED); DrawMenuBar(GetConsoleWindow()); GetSystemMenu(GetConsoleWindow(), FALSE); //Disables …

Member Avatar for triumphost
0
965
Member Avatar for katokato

im new to this c++ thing and windows api thing, and i got most of this code from a tutorial but i modified it alot. how do i retrieve a handle to a dialog box so i can put my menu inside it? (when i put the code for the …

Member Avatar for katokato
0
1K
Member Avatar for prog_newb

[CODE]do{ chatLike("Enter student's full name: "); getline(cin, name, '\n'); //I have my try-catch here }while(error==true);[/CODE] chatLike is a function that i made that produces the cout character per character. program immediately crashes when input is: a)input is space only or a single space b)input ends with one or multiple spaces …

Member Avatar for jonsca
0
180
Member Avatar for Legend32A

I am using the following code to take a screenshot , compress it to jpg and save it. I am trying to compress the image more, e.g. from 200kb --> 100kb. Let's say about 60% of original quality. Could you guys, please help me find out how to do this? …

Member Avatar for WolfPack
0
134
Member Avatar for Legend32A

I am trying to find out if the screenshot I take is 100% black before I save it. If yes then show an error. My code is: [code]#include "stdafx.h" #include <windows.h> #include <GdiPlus.h> #include <string> using namespace std; #pragma comment( lib, "gdiplus" ) int GetEncoderClsid(const WCHAR* format, CLSID* pClsid); void …

Member Avatar for WolfPack
0
506
Member Avatar for mjv89

Hi, I was wondering how I can add a button to my program to allow me to send a message. For example, if the user clicks a button called "Hello", it will send "Hello" to the receive part of my program. To send an ordinary message, I am using the …

Member Avatar for WolfPack
0
77
Member Avatar for DaniwebOS

I'm working on a program for fun but I can't figure out my first problem, also I'm aware the program doesn't end. [CODE]#include <iostream> #include <conio.h> #include <string> using namespace std; //all prototypes void studentName(string&); //all global variables //main void main() { do{ string Name; studentName(Name); cout << "\nStudent Name: …

Member Avatar for jonsca
0
127
Member Avatar for lelejau

I have this code: [code] HWND handle = CreateWindowExA(0,name,name, WS_POPUP+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_SYSMENU+WS_CAPTION, 0x13D,0x86, // x y 0x320,0x258, // width height 0,0,hInst,0); [/code] But my window's name only contains one letter oO My final window name is "W"... what am I doing wrong?

Member Avatar for lelejau
0
161
Member Avatar for MasterGberry

I am interested in learning how to make a simple tic-tac-toe game playable on 2 computers. A small simple project that can help me learn some network coding. I can't seem to pin down a good reference for it. Where is a good place for me to read up on …

Member Avatar for MasterGberry
0
83
Member Avatar for boschow

Hi all, it is possible to declere a function within a structure, then in the main function with the use of the pointers call this function and assign the specific parameters . To make my idea clearer check out the sample code. [code] struct { int AND_function; int math_funct; int …

Member Avatar for asa22
0
157
Member Avatar for chintan_1671

I have a managed class library developed in C#. Now i need to create a win 32 dll wrapper around it. So in my Win 32 DLL i need to import that class library and call the starting point functions from it. I am new on this. I was able …

Member Avatar for chintan_1671
0
267
Member Avatar for daviddoria

I have a class that has a function called Update(). I have written several different update methods, so I now have: [code] class MyClass { double Update1(); double Update2(); double Update3(); private: float Data1; ... float DataN; }; [/code] All of these functions need access to all of the data …

Member Avatar for mike_2000_17
0
110
Member Avatar for daviddoria

I'm having trouble with this "strict weak ordering". Consider a class Point with members x and y. I tried to make the comparison "If both the x values are less than each other and the y values are less than each other, the Point's are less than each other". However, …

Member Avatar for daviddoria
0
229
Member Avatar for VernonDozier

Here's the code. [code] #include <iostream> using namespace std; int a = 0; int foo() { a++; return a; } int main() { if(1 || foo()) { cout << "Hello World\n"; } cout << a << endl; return 0; } [/code] Result : 0 is displayed. Change line 15 to …

Member Avatar for Ancient Dragon
0
176
Member Avatar for liam0014

Hello, I posted yesterday regarding my issues with adding rows to a database, this is now solved and I am grateful. Once the rows were added to the database the list box that displays one column of the database did not update so I included the following code after the …

Member Avatar for Mitja Bonca
0
5K
Member Avatar for caut_baia

Hi everyone.I'll just get to the point.I want to write objects of type B to a file in binary form using fstream and it's 'write' member function.I need to pass a size for an object of type B but since it contains dynamic data and i can't use just a …

Member Avatar for Labdabeta
0
653
Member Avatar for stompjrkz400

ok everyone, i taking my first semester of C++ and i have a little quesiton, the teacher wants up to output and input on the same line, but to send the input through i have to strike enter, which keys to the next line, heres my code, just cant get …

Member Avatar for Labdabeta
0
284
Member Avatar for wingmark

Hi All; Where is the best place to find C++ tut's that are easy enough to follow so that i can start learning C++? Regards Wingmark

Member Avatar for Labdabeta
0
111
Member Avatar for Legend32A

I am trying to replace all % with %%, because I want to write a string to a file using the fprintf_s function. Yet, I done this: [CODE]void replace(std::string& target, const std::string oldstr, const std::string newstr) { unsigned int x; while(x = target.find(oldstr), x != std::string::npos) { target.erase(x, oldstr.length()); target.insert(x, …

Member Avatar for Legend32A
0
100

The End.