49,757 Topics

Member Avatar for
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
184
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 Aeonix

I'm sitting in classroom, trying to find more advanced usage of pointers in C++, suddenly Googling, not suspecting a thing I almost fell of the chair in middle of class laughing like a donkey (I'm young adult, so "immature" jokes tend to be funnier for me than for you likely). …

Member Avatar for mike_2000_17
0
823
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
385
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
Member Avatar for Xia_1

#include<iostream> #include<string> #include <cstdlib> //rand #include<ctime> #include <algorithm> //shuffling #include <vector> using namespace std; int main() { int option,i=0, num_part; vector<string> names; cout << "Welcome to Number-guessing Game !\n\n"; do { cout << "Menu" << endl; cout << "-----" << endl; cout << "1)To register number of participants and name …

Member Avatar for ddanbe
0
127
Member Avatar for Ahmed91za

Hello I'm a freshly new Graduate student of computer technology engineering, i'm interested in C++ as my first step into learning computer science, what books other than Bajarni books do you recommend, i don't like book that are 1000+ pages long, and prefer ones that are straight to the point …

Member Avatar for vijayan121
0
169
Member Avatar for Hector3000

#include <iostream> #include <string> #include <cmath> using namespace std; int main() { string Choice; string On, off; char a = 'A'; int i = 0, j= 0 , NUM = 2 , z = 1; cout << "Please enter 'start' to start the program\n"; cin >> On; if (On == …

Member Avatar for vijayan121
0
190
Member Avatar for usmanjani
Member Avatar for abcdz

redo (or do for the first time) programming project 2 from chapter 11. define your ADT class in separate files so that it can be compiled separately. I need help with that!!!

Member Avatar for bernardo.mclobo
0
102
Member Avatar for jamesjohnson25

Q 1) In this small snippet #include <stdio.h> void passingAddressOfConstants(const int* num1 , int* num2) { *num1 = num2; } int main(){ const int limit = 100; int result = 5; passingAddressOfConstants(&limit,&limit); } Error : error: invalid conversion from 'const int*' to 'int*' Here I defined "limit" is of type …

Member Avatar for aleeha.saqib.5
0
223
Member Avatar for kumanutiw

Create a class Candy with the following data: weight of one candy bag, price of one candy bag. There are three types of candy in the store. Find the weight and price of heaviest candy bag. What is the price of 1 candy bag with minimum weight?  Extend the …

Member Avatar for bernardo.mclobo
0
144
Member Avatar for Mahnoor_1

Ok guys ! I'm trying to study operator overloading. which i found the toughest article in OOP :( I tried a code for == operator overloading to check whether both arrays have same elements or not but it isn't working. Can anyone help? Here is my code: #include<iostream> using namespace …

Member Avatar for aleeha.saqib.5
0
238
Member Avatar for usmanjani

hello guys i need a real good ideas from u i want to create social networking program for c++ like instagram,facebook etc my general q: how to implement the coorect DSA structure on building profiles and mangae post comments message from other freinds and user?

Member Avatar for aleeha.saqib.5
0
122
Member Avatar for Ef
Member Avatar for gusano79
0
110
Member Avatar for jamesjohnson25

import java.util.*; class occult { public static void main(String[] args){ int n = 2; for (int i = 0; ; i++){ if(Integer.toString(i).contains("666")){ if ( n == 1 ) System.out.println(i); n -= 1; } } } } I have written the above java code into c++ . i wanted to know …

Member Avatar for vijayan121
0
515
Member Avatar for nitin1

Hi, Actually, I want to make one Singleton class which will create one instance for one thread. I mean if we have 10 threads, then Singleton will create only one object for one thread. IF same thread will ask for one more instance it will return the same instance. Basically, …

Member Avatar for vijayan121
0
336
Member Avatar for cambalinho

the GetDesktopWindow() give me the desktop HWND, but how can i get the desktop toolbar HWND? i belive that theres 1 function for get the toolbar on windows, but i don't know how :(

Member Avatar for cambalinho
0
150
Member Avatar for Mahnoor_1

I have a little confusion in my mind. I know very well the difference between preincrement and postincrement, postdecrement and predecrement. But i wonder how do these operators work during loop. I ,myself, use postincrement or decrement in loop as follows: for(int i=0;i<5;i++) { //code } But in my book …

Member Avatar for Mahnoor_1
0
277
Member Avatar for can-mohan

Hi All, in below class i wanted to have two friend function(overloading) one with default argument and other is without default argument. but during compilation it gives error. could you let me know how to fix (overload) this by not changing the function name , argument type or number of …

Member Avatar for rubberman
0
287
Member Avatar for Cleophas_1

write a c++ program to compute compound interest. the program should be structured as follows A function to compute interest and another function to compute amount **Bold Text Here**

Member Avatar for Cleophas_1
-1
523
Member Avatar for Hector3000

Design a C++ program by considering the following conditions; 1. User must keyed-in “start” to start the program and “stop” to end the program. . 2. If the user keyed-in “choice1”, print out PATTERN A. 3. If the user keyed-in “choice2”, print out PATTERN B. Use if else statement, while …

Member Avatar for Moschops
0
135
Member Avatar for Zcool31

Hello Everyone! I'm using C++ to write a small 2D app with SDL and OpenGL. I'm trying as much as possible to keep my code cross-platform. However, I've hit a bump. I can't find a good, easy way to display text on the screen. I am able to do it, …

Member Avatar for BeautyBeast
0
1K
Member Avatar for usmanjani

C++ HELP: hello i made a program where user enter any message then fing its frequency and push it on the queue and sort it i want to sort it again by which element in the same piority entered please anyone can help>? for example for this message: "Eerie eyes …

Member Avatar for usmanjani
0
251
Member Avatar for can-mohan

Hi All, I know this is very silly question about singleton pattern but still it is first choice of interviewer. Could you let me know in below code snippet. (1) After deleting singleton object why still i am able to call show() method and it works fine. delete obj; obj=NULL; …

Member Avatar for Moschops
0
200
Member Avatar for Brahim_2

hi all i am new in qt/c++ i am trying to build a program with database using QTableView QLineEdit QComboBox.. the LineEdit shows a valiu the records filtered by that valiu.. now the ComboBox displays somenames with valius and what i want is that when i change the valius in …

Member Avatar for richieking
0
157
Member Avatar for Puru_1

I am getting below errors while compiling on V2013. I have benn struggling it for last 5 days. Any help much appreciated. ------------------------------------ error LNK2001: unresolved external symbol "double pnl::global_fakedummy" (?global_fakedummy@pnl@@3NA) 1>snpgm.obj : error LNK2001: unresolved external symbol "private: static class pnl::LogMultiplexor * pnl::LogMultiplexor::s_pStdMultiplexor" (?s_pStdMultiplexor@LogMultiplexor@pnl@@0PAV12@A) ------------------------------------------------------------------------------------------------ pnlFakeptr.hpp #ifndef __PNLFAKEPTR_HPP__ #define …

0
92
Member Avatar for John A

User input/output is a key component in the programs you write, yet most online tutorials just provide a quick-and-dirty method of grabbing data. In other words, it works right up until the point the user does something unexpected. In this tutorial you will learn how to avoid the common mistakes …

Member Avatar for Khawaja Ghulam
11
7K
Member Avatar for cambalinho

(i'm using win7) i can use the Region functions for get the transparent control. but, in some cases, i can get bad resoltes(. i have read that i can use brushes for get the transparent control. can anyone explain better?

Member Avatar for triumphost
0
915

The End.