49,761 Topics

Member Avatar for
Member Avatar for Quendy

Here is my code, I want to get the coordinate of the mouse position: [code=cplusplus] #include <iostream> #include <string> //#include "WinDef.h" //#include "stdafx.h" #include <windowsx.h> #include <windows.h> #include <atltypes.h> using namespace std; int main() { DWORD pos = GetMessagePos(); CPoint pt(LOWORD(pos), HIWORD(pos)); ScreenToClient(&pt); return 0; } [/code] But I could …

Member Avatar for vmanes
0
550
Member Avatar for alias120

Hi there, new to the community and first of all just wanted to say its great to be here. I'm rather new to C++ and i was having an issue perhaps someone could clear up for me. Alright, our instructor for a class im taking would give us simple programs …

Member Avatar for davids2004
0
158
Member Avatar for nvodapally

Implement a recursive template function for the 2-way Mergesort algorithm. A Main program is provided that tests this function. Can anybody help me out with this question? this is the main function [code=cplusplus] #include <iostream> #include "Student.hpp" #include "MergeSort.cpp" int main() { const int n=10; { Student A[n]; Student tmpArray[n]; …

Member Avatar for skatamatic
0
77
Member Avatar for starletcharmed

Hey! We have to write a function that deletes nodes from a linked list. I was wondering if you could tell me if this is correct, and if not, how I could fix it? [CODE]void delNeg(node * L) { node *cur = L; node *prev = NULL; while(cur != NULL) …

Member Avatar for cikara21
0
99
Member Avatar for scamguru

[B]I have to read a file (for a string) and the file is available only at the compilation time, not in the run time. Is there any possibility to read the file during compilation and initialize a variable with the value read from the file. I have tried different methods, …

Member Avatar for vmanes
0
106
Member Avatar for NewGuyCPP

I'm new to c++ like most people here, but i'm trying to learn to do C++ if one of my courses and its not going well (been given 6 powerpoints to go by). Ok so to the questions: Using Dev-C++ for programming and whenver i put in a number wrong …

Member Avatar for cikara21
0
114
Member Avatar for Oblique

I am trying to create a Space Invaders sort of game. I am using a linked list for the bullets that the player shoots and in the same list, there is also the enemies. I have a addNewEnemy Function which I run once in the main game loop. This adds …

Member Avatar for emotionalone
0
126
Member Avatar for burhanms

Hello, I work on a problem and I want my solution to be picked from discrete numbers.( I want a value for diameter and I want it to be selected from the available diameter values) Does anyone know it can be done with C++ and how? Thanks

Member Avatar for MosaicFuneral
0
94
Member Avatar for NinjaLink

Hello. I am currently having problems. I am asking a user to input the position and number of where they would like to insert into the Linked List. After the user input the information, the number does not appear in the Linked List, but everything else does. Can someone help …

Member Avatar for paramdhingra
0
122
Member Avatar for risa

Hi, How to insert a combox to a column of list ctrl in MFC?....such tht i can select a particular item from a list of items in the combo box of list ctrl column....plz help

Member Avatar for Nick Evan
0
91
Member Avatar for NinjaLink

Hello. I'm having problems in 2 different functions: GetNth() and InsertNth() 1) For my GetNth() function, I want to take my linked list and an integer index and return the data value stored in the node at that index position. For example: {42,13,66}, the index of 1 should print out …

Member Avatar for NinjaLink
0
204
Member Avatar for madmaxx350

How do you exit a sentinel controlled loop forcefully ? [code]while (finalstar != word && ct1 < 7) { let_pos = word.find(letter); if (let_pos != string::npos) { get_letter = word.substr(let_pos,1); new_letter = finalstar.substr(let_pos,1);// gets star from string made of stars new_letter = finalstar.replace(let_pos,1,letter); cout << "Right !!" <<endl; ct1 = …

Member Avatar for MosaicFuneral
0
98
Member Avatar for meddlepal

I am trying to solve a tricky problem involving a sorted array. Say I have an array of sorted integers (8, 6, 4, 1) and given the value x I need to check the array to see if any two numbers add up to x. This needs to be done …

Member Avatar for meddlepal
0
135
Member Avatar for kotkata

[code]void decryption() //this function decrypts whatever the user inputs using keys 1 - 100, providing all possible decryptions { const int MAX = 100; string code, output; char array[100]; cout << "Enter what you would like decrypted" << endl; cin >> code; //herein lies the problem strcpy(array, code.c_str()); for (int …

Member Avatar for kotkata
0
92
Member Avatar for jimbob90

im writing a simple program that turns a decimal to hex. im only posting the piece of code where i have the problems [code] string hexnumeral (int d) { int h,l; string e,y,f; if (d < 16) return hexdigit (d); else { f = d / 16; h = d …

Member Avatar for Ancient Dragon
0
98
Member Avatar for Niner710

Hi, I am writing output to a file and am using ostream. I wanted to format my output and not sure how to do it. Here is some simple code. [code] int var1; int var2; ofstream out("blah.txt"); out << "Name " << var1 << endl; out << "NameofAnotherPerson << var2 …

Member Avatar for Ancient Dragon
0
112
Member Avatar for dankbc1

Hey guys, I'm having a problem with my checkers program; whenever I move the piece, it redraws the whole board and basically puts the piece back into its original position. The code is attached to this post. Thank you for your help!

Member Avatar for dankbc1
0
92
Member Avatar for Lukezzz

Is there a way to Alt-F4 programatically. It will be used to close another programs window that opens wich is the topmost form on the desktop.

Member Avatar for Lukezzz
0
187
Member Avatar for j_p36

Ok, so I've been working on this code for a day now and i thought I had all the kinks worked out, but my program isn't working right. I'm writing this code to simulate a game (basically a simulation of a simulation) used to illustrate some topics we are trying …

Member Avatar for j_p36
0
180
Member Avatar for Tausif214

please help me with this Assignment: Write a program that will read the critical path information from the attached file (ProjectInfo.txt) into 3 arrays, events, tasks and numDays and defines a 4th array called eventNumDays in which you will calculate the number of days needed for each event to complete, …

Member Avatar for Tausif214
0
95
Member Avatar for MJFiggs

I am a bit confused. I am trying to make a program that will take the choices you make and display them all simular to this: Item 1. Sword Item 2. Shield Item 3. Potion Item 4. Potion but when I try to run it it looks more like this …

Member Avatar for MJFiggs
0
135
Member Avatar for GDICommander

Hi, everyone. I am doing a performance test on the heapsort. I wrote this program and it has a run-time error that I cannot explain. I am compiling on Microsoft Visual Studio 2008 and this is the error. HEAP CORRUPTION DETECTED after Normal Block ... well, I think that the …

Member Avatar for GDICommander
0
114
Member Avatar for Foe89

I'm really not understanding what's going on with the array in this. Here's the question. The following code totals the values in each of the two arrays. Will the code print the correct total for both arrays? [code] int total = 0; int count; for (count = 0; count <= …

Member Avatar for ddanbe
0
114
Member Avatar for hello11

Here is my code I'm pretty sure the problem has to do with using namespace std and the included header files but I can't figure it out (error string no such file or directory in .h, error iostream no such file or directory in .h,error syntax error before namespace) box.h: …

Member Avatar for Ancient Dragon
0
106
Member Avatar for Lokolo

Main.cpp This is where the problem lies. [code] #include <iostream> #include <time.h> #include <math.h> #include <iomanip> #include "LinkedList.h" #include <fstream> #include <string> using namespace std; void main(void) { LinkedList Customers; Customer* newCustomer; Entry* test; int i = 0; newCustomer = new Customer(1001, "Olly", "07/10/1988", "17 Bob Lane", "Hobbs Road", "UB3 …

Member Avatar for Lokolo
0
113
Member Avatar for nedsnurb

Hi Have written this code for a program that requires the user to either enter 1 or 2 dependant on whether the program solves the problem of finding the divisors of any given to numbers by recursive or iteration methods. [code] #include<iostream> using namespace std; int recursiveGCD(int ,int ); int …

Member Avatar for nedsnurb
0
131
Member Avatar for scamguru

Please help me. I have to read CVS Tag of a file or directory from C++ program in LINUX. Any small idea is also welcome. Thanks in advance.

0
43
Member Avatar for Cwapface

Okay, I cannot figure this out. I still get the same error: [QUOTE]Error 1 error C2039: 'function' : is not a member of 'D'[/QUOTE] Here's what I have: Class A.h: [CODE] #pragma once #include <string> using namespace std; class D; class A { public: void function(string s); friend class D; …

Member Avatar for mrboolf
0
102
Member Avatar for kavithabhaskar

Hi: I need some assistance in this code. I am trying to get this format. 1 .2 ..3 ...4 and so on.. i dont get any errors in the code but i get no o/p eitehr [code] #include<iostream.h> int main() { int i; cout.fill('.'); for(i=i;i<10;++i) { cout.width(i); cout.fill('.'); cout<<i; }}[/code]

Member Avatar for chococrack
0
146
Member Avatar for nnhamane

Can anyone tell me what is the main purpose of Dll? As we can get the data from Dll, can we put the data in Dll? I am not talking about code, talking about single Dll. If you know about Dll then please share your knowledge..

Member Avatar for kux
0
111

The End.