49,761 Topics
| |
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 … | |
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 … | |
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]; … | |
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) … | |
[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, … | |
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 … | |
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 … | |
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 | |
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 … | |
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 | |
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 … | |
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 = … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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! | |
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. | |
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 … | |
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, … | |
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 … | |
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 … | |
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 <= … | |
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: … | |
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 … | |
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 … | |
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. | |
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; … | |
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] | |
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.. |
The End.