49,757 Topics

Member Avatar for
Member Avatar for aluhnev

int Cabin (int n); int _tmain(int argc, _TCHAR* argv[]) { cout << Cabin(8) << endl; return 0; } int Cabin (int n) { if (n == 1) return 0; else return Cabin(n/2) + 1; } Hi ,can someone explain why is the answer 3 here:if to folow the formula the …

Member Avatar for aluhnev
0
259
Member Avatar for tgreiner

I have written some code that contains a system to report error messages to error log file. I use a class structure to do this. However, some parts of the code contain functions that I think might be useful in a more generic context. So, I am trying to use …

Member Avatar for tgreiner
0
169
Member Avatar for aluhnev

//Hi Lads.This is my first attempt to create template functions. //Here is the main ,which needed to create Locate.h file/header and //in that Locate.h create templates to support the main. //If the value does not exist in the array, -1 is returned. // Templates.cpp : Defines the entry point for …

Member Avatar for aluhnev
0
191
Member Avatar for ADHAMLOVER

The area of the circle is defined as A = π . R2, having π as 3.14159. Calculate the area using the formula given in the problem description. Input Read the variable R (double precision), that is the radius of the circle. Output Print the variable A, rounded to four …

Member Avatar for NathanOliver
0
79
Member Avatar for HuePig

Hi, I have a Blackboard object which is a singleton, what it does is store the message and the reciever. The challenge is that the blackboard will send an alert to the reciever and the reciever have to check the blackboard for the message. class Subscriber{ public: virtual ~Subscriber() {} …

Member Avatar for Banfa
0
345
Member Avatar for JayGarxP

I keep getting access violations even though I made sure to make all my methods and functions const! Driving me insane. When I add a player then try to display all players the program tries to read my privates then gets violated. (Still lots of bugs in it elsewhere, but …

Member Avatar for Banfa
0
282
Member Avatar for cambalinho

by several reasons, i must create the static with it's paint message: case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(inst->hwnd, &ps); if(inst->Paint==NULL) { RECT f; GetClientRect(hwnd,&f); HBRUSH s=CreateSolidBrush(inst->clrBackColor); SelectObject(hdc,(HBRUSH)s); if (inst->clrBackColor==-1) { //hide, copy the parent control and show the control again ShowWindow(inst->hwnd,SW_HIDE); BitBlt(hdc,0,0,f.right-f.left,f.bottom-f.top,GetDC(GetParent(inst->hwnd)),inst->intLeft,inst->intTop,SRCCOPY); ShowWindow(inst->hwnd,SW_SHOW); } else FillRect(hdc,&f,s); SetBkMode(hdc,TRANSPARENT); …

0
101
Member Avatar for Edwins_1

Suppose we have a polynomial f(x) = 4 – x3. We want to find the value of x that makes f(x) = 0. (This value, call it t, is the cube root of 4. In fact we can use the bisection method to find the nth root of a number.) …

Member Avatar for magdaekeya
1
219
Member Avatar for psmb

I need a C++ program to implement a heap based priority queue which accepts job ID, priority number and submitter name as inputs. the program should heap sort whenever a new job ID or priority or submitter name is entered. The jobs that have maximum priority should be extracted (along …

Member Avatar for mike_2000_17
0
190
Member Avatar for lewashby

In the following program, where is pt1 getting it's values (1, 0)? I get pt3's values (5, 10) because I can see them in the code. #include <iostream> using namespace std; class Point { private: int x, y; public: Point() {} Point(int new_x, int new_y) { set(new_x, new_y); } void …

Member Avatar for AndrisP
0
125
Member Avatar for ceelos1974

I need help combining the file name with the filepath my code: WIN32_FIND_DATA FindData; HANDLE hFind; hFind = FindFirstFile(L"../art/*.dds", &FindData ); if( hFind == INVALID_HANDLE_VALUE ) { PrintCharS("Error searching directory"); return; } do { char ch[260]; char DefChar = ' '; WideCharToMultiByte(CP_ACP, 0, FindData.cFileName, -1, ch, 260, &DefChar, NULL); string …

Member Avatar for vijayan121
0
314
Member Avatar for dannie.duxug.5
Member Avatar for nicole.c.quintana.3
0
80
Member Avatar for Gunjan_1

What is the difference between access modifier, modifier and qualifier? It's a competition exam question. and is a very important question from exam point of view. plz help me to get the answer of this question.

Member Avatar for mobashir20
0
119
Member Avatar for Maredi

Using strictly pointer data type, write a modular C++ program that makes use of a single function called convert() to sort two integer numbers passed to it as arguments, exchanging them if the first is smaller than the second (Descending order). Example: if the function is called in main() as …

Member Avatar for mobashir20
-1
141
Member Avatar for arif421

How many times is the inner loop body executed in the following nested loop? for (int x =1; x <= 10; x++) for (int y = 1; y <= 10; y++) for (int z = 1; z <= 10; z++) cout << x +y+z;

Member Avatar for Schol-R-LEA
-1
48
Member Avatar for rk1993

For instance, ABBA is a palindrome, but ABCBB is not. You are given a string s. Return the length of the longest substring of s that is a palindrome..program in c++

Member Avatar for gtcorwin
0
183
Member Avatar for andruluchko

Hello. I have a following verse: >A swarm of bees in May >Is worth a load hey; >A swarm of bees in June >Is worth a silver spoon; >A swarm of bees in July >Is hot a worth a fly. And I have to modify this text so that all …

Member Avatar for L7Sqr
0
179
Member Avatar for Daniel_30

I am a student in Computer Science, and am writing a small guide for my fellow students. It will contain a large list of the most commonly used and studied functions in C++ (e.g. Bubble Sort, linear search, file writing, etc.) and the code used to perform each function. I …

Member Avatar for Daniel_30
0
109
Member Avatar for Avladimir

The loan officer at the Belize National Bank wants you to write a C++ program that would help him decide whether to approve small loan application. The program should prompt the user for the customer’s yearly income, the number of years of the loan (loan period), the amount of the …

Member Avatar for vegaseat
0
153
Member Avatar for munchlaxxx

Say I have something similar to this: http://faculty.utpa.edu/chebotkoa/main/teaching/csci3336spring2013/slides/lexsyn/sample-lex-syn.html Does anyone know how I would be able to make "\n" or "\t" recognized as a token? I would probably need to add a case for it in the switch in LexicalAnalysis.cpp, right? And add it to the state diagram? But how …

Member Avatar for Schol-R-LEA
0
323
Member Avatar for vickietende

Come up with a program that prompts the user to enter three movies and display the entered information using your understanding of data strucures. // Structures3.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include<string> #include<sstream> using namespace std; # define N_movies 3 struct movies_t{ …

Member Avatar for JasonHippy
0
115
Member Avatar for cambalinho

from reading these site: http://www.catch22.net/tuts/flicker-free-drawing i understand that i must avoid the pixel been changed more than once and a double-buffer: //how avoid the pixel be changed more than once: case WM_ERASEBKGND: return 1; //for other controls, we must use another messsage(see the child control messages) and heres how we …

0
178
Member Avatar for Sunil_12

Hello All, I am writing c++ program to insert, sort, display and merge two linked lists. Insertion, sorting and display functions are working fine but merge function is not working as expected. Please help me correcting merge function. I have used One header file "intSLLst.h" and two cpp file "intSLLst.cpp" …

Member Avatar for Lerner
0
684
Member Avatar for jarleking

hi there people i got a prob with my code in my problem i got a matrix and i need to find the even number or numbers on that matrix (12x30) (by the way is the even minimun or minimums), so here is my function "tempeven" part., the actual issue …

Member Avatar for jarleking
0
108
Member Avatar for tapiwa.matombo

in response to an inclass exercise where the following question was possed: write a program using structures, which will capture a list of 10 movies, the data members should be title and year. the problem is the program is not capturing all the details and is printing unintelligible information. what …

Member Avatar for Banfa
0
151
Member Avatar for ceelos1974

Hi I got a problem with converting from LPARAM to std::string. What I do is getting the selected object from a Listbox, the example I found on how to do this is to convert the object to LPARAM. Now I want to convert this LPARAM to std::string and I've tried …

Member Avatar for ceelos1974
0
2K
Member Avatar for wad11656

So basically I have: // FUNCTION double function(yadee_yada) if (input < 0) { return 0; } else { return something; //code } // END FUNCTION //MAIN int main { int menu; int input; do { cout << "Press 1, 2 or 3 (3=quit program)."; cin >> menu; switch (menu) { …

Member Avatar for Banfa
0
164
Member Avatar for hui

I am creating a program that stores information of hospital patients in a sequential text file.. I want to the program to be able to search for a patient using the patient name already in the text file.. The program is giving me no errors whatsoever so please look into …

Member Avatar for JessiE_03
0
177
Member Avatar for Genessis_1

I am currently trying to test a function with an infinite loop and im having a problem how to break. Is there anyway I can test this? Thanks in advance. void classA::process() { unsigned int return_val; proxy_class& proxy = proxy.instance(); while(1) { return_val = proxy.run(); if(0 == return_val) { //some …

Member Avatar for Dani
0
2K
Member Avatar for musab.hussain.7

All the images those i added in resources of qt project , now i have lost those .. but those are available in "qrc_qresources.cpp" file in any other form (i think 'hexa' ) .. i want to extract images to original form .png .jpg etc .. plx help

Member Avatar for triumphost
0
33

The End.