49,757 Topics
| |
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 … | |
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; … | |
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(); … | |
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?_ | |
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 … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
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. … | |
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 … | |
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 … | |
| 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 … |
#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 … | |
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 … | |
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 = … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Can any body have code to make own data types | |
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; }; … | |
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"; … |
The End.