49,757 Topics

Member Avatar for
Member Avatar for Sandy20

Evniorment : Windows 7.0 , C++ , Multithreading I have created a new worker thread to receive data on socket & add it into static multimap. **code snap :** //remember mymultimap is static data type static std::multimap<string,string> mymultimap; EnterCriticalSection(&m_criticalsection); mymultimap.insert ( "aaa", "bbb") ); LeaveCriticalSection(&m_criticalsection); At same time my main …

Member Avatar for Banfa
0
307
Member Avatar for new_developer

Can we access updated public variable of one class in another class without inheritance. Just like below. This class A which have public int variable x. In updateValue function i have updated x value. class A { public: int x; A() { x=0; } void updateValue() { for(int i=1; i<=5; …

Member Avatar for Lucaci Andrew
0
5K
Member Avatar for BirdaoGwra

Hi, I am trying to test this timer movement and I just don't understand why the rectanglee is not moving right and down. Here is a simple test. Using GLFW. #include <GL/glfw.h> #include <stdlib.h> void Init() { //! Create the viewport and projection glClearColor(0.4f,0.4f,0.4f,1.0f); glViewport(0, 0, 800, 600); glMatrixMode(GL_PROJECTION); glLoadIdentity(); …

Member Avatar for BirdaoGwra
0
458
Member Avatar for amalaza

1.binary 2.decimal 3.octaldecimal 4.hexadecimal enter your choices 1-4?_ enter binary:_ in decimal:_ in octal:_ in hexa:_ do you want to repeat the programm? yes or no?_

Member Avatar for amalaza
0
245
Member Avatar for Gazzmonkey

Hi all, This code below is not my own work but is exactly what I need for my project, the code runs a real time clock through an Arduno Duo development board as it's micro-controller using an I2C connection if that all makes sense. The problem is when running the …

Member Avatar for ajit.nayak
0
782
Member Avatar for tristanhall

I'm trying to make a program for my computer science class and it requires that I run output to the console as well as to a file. I'm looking for a way to intialize a string at the beginning of the program and pass the variable by reference to my …

Member Avatar for tristanhall
0
302
Member Avatar for Suzie999

I have searched high and low for a definitive answer to this, and I cannot find one (that I understand) The windows function [GetPixel](http://msdn.microsoft.com/en-us/library/windows/desktop/dd144909(v=vs.85).aspx) takes 3 arguments (HDC, int, int). Both ints represent a coordinate in the devive context, but are measured in logical units, x = > The x-coordinate, …

Member Avatar for Suzie999
0
280
Member Avatar for VictorK19

Heres the assignment: > Write a program that will perform sorting and searching across records stored in a file. > The program should first query the user for a filename. The program should open the file and read > the first entry. It defines the number of records in the …

Member Avatar for tinstaafl
0
196
Member Avatar for lewashby

The following code block is producing and endless loop and I can't figure out why. Note that charv is just he second command line argument in the main function. int testNumber = 1; while(argv != '\0') { std::cout << testNumber; argv++; testNumber++; } I wrote this piece of code just …

Member Avatar for Suzie999
0
161
Member Avatar for sh4rif

Hello everyone I am running Ubuntu 12.04 compiling a c++ file which has the following code #include <iostream> #include <libusb-1.0/libusb.h> using namespace std; int main(){ //pointer to pointer of device used to retrieve a list of devices libusb_device **devs; libusb_device_handle *dev_handle; //a device handle libusb_context *ctx = NULL; //A LIBUSB …

Member Avatar for Moschops
0
310
Member Avatar for cobaltfive

so i was wondering if my program could be converted to a string version, if so gimme a start please. I also would like to find out how to set my speed variable if when entered it is less than zero for it to display an error statement, how would …

Member Avatar for tinstaafl
0
275
Member Avatar for xanthian23

So I'm just having a super fun time with overloaded operators and the friend function. I have an addressbook, and for my assignment I have to use the friend function to overload a few different operators. I think I understand how to type the friend function out to tie it …

Member Avatar for xanthian23
0
248
Member Avatar for Suzie999

I'm here with what might seem like a very basic question, but I cannot figure it out. I am using EnumChildWindows winapi to identify a particular child window of google chrome browser. I fail when trying to return the handle of that child window when found. BOOL CALLBACK enum_wnd_proc(HWND h, …

Member Avatar for Suzie999
0
1K
Member Avatar for pars99

Me and my friend are aspiring Indie Game devs. and we're hoping to get some help. As the developer of the duo (him being artwork and music), I need to create a physics engine for the game. I am sure there are some out there, but I think building one …

Member Avatar for Tumlee
0
822
Member Avatar for Kareem Klas

Hello everyone, I'm studying the while statement now, and there is an example code and I tried to make it and see what it does. When I wanted to start it said it has errors and when I started with debugging I get a weird statement on my cmd program. …

Member Avatar for andreas.bjorn
0
133
Member Avatar for nah094020

So i just started my project on a cpu sim , but right of the bat i ran into a problem #include <cstdlib> #include <fstream> #include <iostream> using namespace std; /* * */ int main(int argc, char** argv) { return 0; } void cpu() { } void memory() { int …

Member Avatar for nah094020
0
499
Member Avatar for nah094020

Ok so here is my problem, i have to write a simple computr system consisting of the processor and the memory, The project will simulate a simple computer system consisting of a CPU and Memory. The CPU and Memory will be simulated by separate processes that communicate I have to …

Member Avatar for nah094020
0
665
Member Avatar for nssrsaran

Hello, Will you please write a c++ program which includes all functions, 1) Recursive function for "vowels", that returns number of vowels in string. 2) Recursive function for "sum of array" 3) Program that uses a recursive function to check whether a string is Palindrome 4) Program that uses recursive …

Member Avatar for Gonbe
0
2K
Member Avatar for tanmay.majumdar2

#include<iostream.h> #include<conio.h> using namespace std; int re(int); int main() { int a, asd; cout<<"enter number\n"; cin>>a; asd=re(a); cout<<asd; getch(); return 0; } int re(int a) { int b; if(a==1) return ( 1 ) ; else b=re(a-1); return (b); } Hey, i was just trying to understand the concept of recursive …

Member Avatar for Gonbe
0
391
Member Avatar for TayKaye

Hello All, I am new to this so I am not sure if this is going to post correctly. I am trying to create a rock, paper, scissors game. My issue with my code is I only want the code to repeat if the computer picks the same choice as …

Member Avatar for jogosde
0
3K
Member Avatar for beanmiester

I've spent the better part of two hours going over my code line by line and I cannot find the problem for the life of me. #include "stdafx.h" #include <iostream> using namespace std; class NumberList { struct ListNode { int value; ListNode *next; public: ListNode(int val, ListNode * nextp = …

Member Avatar for JasonHippy
0
302
Member Avatar for kshahnazari

hello programmers . I have a question not a syntax one but I need it for speed in contests we have a 3x3 array and when we call a number it add to itself and around him +1 but in many casses like [0][1] when we want to add around …

Member Avatar for ravenous
0
114
Member Avatar for i3-540

I'm having trouble solving this problem in C++: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I have …

Member Avatar for np complete
0
188
Member Avatar for Kareem Klas

Hallo everyone, I've been studying C++ active for a couple of days. And I was thinking about that all my codes and with: { return 0; } So I wanted to know why and in my book I found: > The only statement in this block is a return, which …

Member Avatar for PrimePackster
0
1K
Member Avatar for bCubed

This program is supposed to shuffle a Deck of cards and display them so I know it is working correctly. But one of the values displayed is -858993460 which is not possible when it should only be between 1 and 52. Obviously there is some sort of data loss going …

Member Avatar for bCubed
0
205
Member Avatar for helloworld1234

my professor has asked us to solve the following problem but im having trouble understanding it **Write a function that takes in a 2 dimensional array of integers and returns the third largest number. Let the number of columns of your 2 dimensional array be 5. Call this function from …

Member Avatar for zeroliken
0
232
Member Avatar for cdsr

Alright so I've been struggling to find the error but I simply can't. Given the following code: #include <iostream> #include <vector> enum ScriptType { SCRIPT_TYPE_CREATURE_SCRIPT, SCRIPT_TYPE_PLAYER_SCRIPT }; class Script { private: ScriptType type; public: Script(ScriptType type) : type(type) { } ScriptType getScriptType() const { return type; } }; class CreatureScript …

Member Avatar for cdsr
0
294
Member Avatar for BARI DANIYAL
Member Avatar for on93

anyone know how to use bubble sort and also binary search ? this program cannot search out the name that user insert. anyone know how to fix it ? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include<iostream> #include<string> #define size 5 using namespace std; struct student { string name; int id; string prog; double cgpa; }; …

Member Avatar for rubberman
0
172
Member Avatar for Shft

Hello daniweb, I've been trying to impliment arrow keys into my program, I've found a way, but the problem is I cant figure out how to use the enter key to select an option as follows: pawns: int pawn; system("cls"); pawndd: gotoxy(0,0); SetConsoleTextAttribute(hColor,455); cout<<" RETURN TO PREVIOUS MENU"; SetConsoleTextAttribute(hColor,23); cout<<"\n"; …

Member Avatar for deceptikon
0
332

The End.