48,986 Topics

Member Avatar for
Member Avatar for myk45

Hi All, I am trying some experiments with pthread scheduling policies. I have a couple of apps and within all these apps, I set the thread policy to SCHED_RR and I set the priority to MAX - 1. Now, I see that the CPU utilization as reported by top for …

Member Avatar for iš_iš_iš
0
237
Member Avatar for nathan.pavlovsky

Hi all! Whenever I am working with my code in my main.cpp file, I can call character-handling functions like * isdigit * isalpha * isspace * toupper without importing the `cctype` library. However, my C++ How to Program Book shows that the cctype library must be imported before the functions …

Member Avatar for nathan.pavlovsky
0
258
Member Avatar for karthick_2
Member Avatar for 111100/11000
-6
78
Member Avatar for Aabir

#include<iostream.h> #include<conio.h> int main(void) { void hello() { cout<<"HI"; } getch(); return 0; } I am getting an error at line 6 stating that declarartion syntax error. What do I do?

Member Avatar for NathanOliver
0
498
Member Avatar for Seth_1

Okay so let me start by saying I have a pretty decent c++ base and very advanced logic skills. So whatever help you will have to provide will probably be minimal. So here's my problem: I've been trying to figure out the best way to organize all my Magic: The …

Member Avatar for David W
0
144
Member Avatar for nathan.pavlovsky

Hello all! I am trying to take a string that has mixed uppercase and lowercase chars and then convert it to lowercase. I am doing the following line of C++ code: transform(theReadMessage.begin(),theReadMessage.end(),theReadMessage.begin(),theReadMessage.end(),::tolower); //theReadMessage is a string to convert to lowercase and my C++ xCode debugger gives me this message `Too …

Member Avatar for nathan.pavlovsky
0
719
Member Avatar for juansgc

Hi! I don't know how to assign my unique_ptr a new value. std::unique_ptr<int> intPtr; void changePointer(int* ptr) { // I want intPtr to point to ptr // intPtr = ptr; } What should I do? Thanks.

Member Avatar for juansgc
0
146
Member Avatar for Suzie999

Hi I have encountered a problem where I cannot think of a solution. I'm attempting to work with event tracing but the problem is that a handle is not released even when the program exit, and the API appears such that once it is opened or started, it is closed …

Member Avatar for gusano79
0
261
Member Avatar for Mariana_1

Hi I am trying to do a game to children so they can notice the difference between to images and study how their memory atention etc are. I want to open the image, and make a questionair where I say if the child was able to find one two three …

Member Avatar for NathanOliver
0
214
Member Avatar for strongard63

I have a large piece of code : string num_to_text[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; string tens_to_text[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; string power_to_text[] …

Member Avatar for m.shajeeh
0
181
Member Avatar for lewashby

#include <iostream> #include <stdlib.h> #include <cstring> #include <stack> using namespace std; #define MAX_CHARS 100 int main(int argc, char* argv[]) { char input_str[MAX_CHARS + 1], *p; stack<double> num_stack; int c; double a, b, n; cout << "Enter RPN string: "; cin.getline(input_str, MAX_CHARS); p = strtok(input_str, " "); while(p) { c = …

Member Avatar for Suzie999
0
258
Member Avatar for jamesjohnson25

I have four files in c++ 1. BankAccount.h 2. BankDatabase.h 3. Main.cpp BankAccount.h #include <string> class BankAccount { public: BankAccount(int accNumber,const std::string& accName); void setAccNumber(const int accNumber); int getAccNumber() const; void setAccName(const std::string& clientName); std::string getAccName() const ; protected: int mAccNumber; std::string mAccName; }; BankAccount::BankAccount(const int accNumber, const std::string& accName):mAccNumber(accNumber),mAccName(accName){} …

Member Avatar for David W
0
165
Member Avatar for jamesjohnson25

I have four files in c++ 1. BankAccount.h 2. BankDatabase.h 3. Main.cpp //BankAccount.h #include <string> class BankAccount { public: BankAccount(int accNumber,const std::string& accName); void setAccNumber(const int accNumber); int getAccNumber() const; void setAccName(const std::string& clientName); std::string getAccName() const ; protected: int mAccNumber; std::string mAccName; }; BankAccount::BankAccount(const int accNumber, const std::string& accName):mAccNumber(accNumber),mAccName(accName){} …

Member Avatar for David W
0
588
Member Avatar for can-mohan

Hi All, In below code snippet i am getting segmentation fault. Could you let me know what can be cause. usually we will face segmentation fault if auto_ptr is used due to ownershpt issue (Assignee pointer becomes NULL) but why i am facing the same issue with unique_ptr move semantics. …

Member Avatar for can-mohan
0
2K
Member Avatar for belalhamdy

I'm tring to develope newcamd virtual server i have read the newcamd protocol documentation there is some missed Points the newcamd protocol uses 3des encryption 112bit CBC Mode point one : what is the padding mode?? point two : what is the vector key?? another thing for example i spyed …

Member Avatar for Zurab
1
724
Member Avatar for rakib.tanbir

Declare a class (i.e., a type) called CArea and an object (i.e., a variable) of this class called obj. This class contains four members: two data members of type int (member x and member y) with private access and two member functions with public access: set_values() and area(). Calculate the …

Member Avatar for David W
-1
260
Member Avatar for Anshu27

Hi, I am trying to create a vector of a class which contains ofstream object as one of its member. The problem I am facing is that when I add single element to the vector, it work fine. As soon as I add another element to the vector, it changes …

Member Avatar for Schol-R-LEA
0
754
Member Avatar for festus_2

The heating system in a school should be switched on if the average temperature is less than 17 degrees Celsius. The average temperature is found from the temperatures in the art English and music departments. You are required to write a C++ program that allows the user to input 3 …

Member Avatar for nullptr
0
114
Member Avatar for daystarsam

Given a collection of towns in Borneo, Your task is to design a program using C++ programming language to find a way to visit all the towns and return to the starting point by minimising the distance travelled. Please note that each town can be visited only once, except for …

Member Avatar for Schol-R-LEA
-2
134
Member Avatar for segadude

For my (online) programming class, I have to format certain output in columns using setw. I am having trouble understanding how to do this. My professor says that I am supposed to be creating columns, not counting characters to align things. I haven't been able to find any examples of …

Member Avatar for NathanOliver
0
204
Member Avatar for jamesjohnson25

There was a question in topcoder. Question: Three kids are playing the following game: A word is written on a sheet of paper, and one after another, the players take turns adding letters to the word. During each turn, a player must add a single letter to either the beginning …

Member Avatar for Nutster
0
116
Member Avatar for kumanutiw

The house is built of non-standard form. All four walls are of a rectangular shape, but different height and length. The width of the walls is two bricks. There are two types of bricks. The outer part of the wall is constructed from the first type of brick, and the …

Member Avatar for David W
0
496
Member Avatar for Sherab_1

I am beginner in C++. Please someone support me. Help me in learning C or C++ Java compiler. I am just a beginer. have just installed Cygwin & MinGW in my computer. Please someone guide me in learning programing language.

Member Avatar for Curius
0
128
Member Avatar for Ahmed91za

hello i'm trying to figure out how to write a program in c++ that check when i insert a password and force me to add at least 2 capital letters and 2 numbers in the password (you've seen this before right? when signing up for new account and checks for …

Member Avatar for ravenous
0
281
Member Avatar for cambalinho

heres my function for select the font: CHOOSEFONT ShowSelectFont(HWND hwnd=GetForegroundWindow()) { CHOOSEFONT cf = {sizeof(CHOOSEFONT)}; LOGFONT lf; cf.Flags = CF_EFFECTS | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; cf.hwndOwner = hwnd; cf.lpLogFont = &lf; cf.rgbColors = RGB(0,0,0); cf.lpLogFont->lfStrikeOut=FALSE; cf.lpLogFont->lfUnderline=FALSE; cf.lpLogFont->lfHeight=-MulDiv(12, GetDeviceCaps(GetDC(hwnd), LOGPIXELSY), 72);//change font size _tcscpy(cf.lpLogFont->lfFaceName, "Arial" ); //we must include tchar.h if(ChooseFont(&cf)) { …

Member Avatar for cambalinho
0
1K
Member Avatar for kumanutiw

class brick { private: int length, width, height;// in mm public: void set(int len, int wid, int hei); int getlength(){return length;} int getwidth(){return width;} int getheight(){return height;} }; void brick::set(int len, int wid, int hei) { length=len;width=wid;height=hei;} #include <iostream> using namespace std; /*After Set() method write main() function which would …

Member Avatar for NathanOliver
0
182
Member Avatar for kumanutiw

class item { public: string name; string code; double price; }; class buyer { public: string name; int count; }; #include<string> #include<iostream> using namespace std; int main() { item item1; buyer buyer1,buyer2; double sum1,sum2,sumTotal; cout<<"enter name, code and price of item:"<<endl; cin>>item1.name>>item1.code>>item1.price; // The data for the first buyer cout …

Member Avatar for richieking
0
144
Member Avatar for One more line

I would like to say hello, first of all. I have been attempting to change the color of a character on my program for some time now. The characters in question will represent lava tiles with the letter "L" in my program. I would like to know how I can …

Member Avatar for Maxime_2
0
4K
Member Avatar for cambalinho

i have these function for get the string size: SIZE GetStringSize(string text, HWND hdccontrol=GetForegroundWindow()) { RECT textrect={0}; HDC txthdc=GetDC(hdccontrol); DrawText (txthdc,text.c_str(),-1,&textrect,DT_CALCRECT); ReleaseDC(hdccontrol,txthdc); SIZE a={textrect.right-textrect.left, textrect.bottom-textrect.top}; return a; } the 1st string size isn't correct. then i get the correct one. so why i get, sometimes, the wrong size? something to …

Member Avatar for cambalinho
0
382
Member Avatar for Xia_1

Problem Statement Number-Guessing Game Assignment Write a program for a number-guessing game. Each player will be given 10 attempts to key in a 4-digit number to guess the randomly generated number. All four digits of the computer-generated number MUST be different and the left-most digit cannot be zero. Create a …

Member Avatar for NathanOliver
0
232

The End.